Ejemplo n.º 1
0
 /**
  *  Returns the cell height.
  *
  *  @return the cell height.
  */
 public float GetHeight()
 {
     if (image != null && !ignoreImageHeight)
     {
         return(image.GetHeight() + top_padding + bottom_padding);
     }
     return(font.body_height + top_padding + bottom_padding);
 }
Ejemplo n.º 2
0
        public static float DrawImg(PDF pdf, Page page, string imgfile, float offsetY)
        {
            System.Drawing.Image image = System.Drawing.Image.FromFile(imgfile);
            double val    = (double)pdfUtil.PDFpageeffwidth / (double)image.Width;
            double val2   = (double)(pdfUtil.PDFpageeffHeight - offsetY) / (double)image.Height;
            double factor = System.Math.Min(val, val2);

            PDFjet.NET.Image image2 = new PDFjet.NET.Image(pdf, new System.IO.BufferedStream(new System.IO.FileStream(imgfile, System.IO.FileMode.Open, System.IO.FileAccess.Read)), ImageType.JPG);
            image2.SetLocation(pdfUtil.PDFleft_margin, pdfUtil.PDFtop_margin + offsetY);
            image2.ScaleBy(factor);
            image2.DrawOn(page);
            return(image2.GetHeight());
        }
Ejemplo n.º 3
0
        /**
         *  Returns the cell height.
         *
         *  @return the cell height.
         */
        public float GetHeight()
        {
            float cellHeight = 0f;

            if (image != null)
            {
                float height = image.GetHeight() + topPadding + bottomPadding;
                if (height > cellHeight)
                {
                    cellHeight = height;
                }
            }

            if (barCode != null)
            {
                float height = barCode.GetHeight() + topPadding + bottomPadding;
                if (height > cellHeight)
                {
                    cellHeight = height;
                }
            }

            if (textBlock != null)
            {
                try {
                    float height = textBlock.DrawOn(null)[1] + topPadding + bottomPadding;
                    if (height > cellHeight)
                    {
                        cellHeight = height;
                    }
                }
                catch (Exception) {
                }
            }

            if (drawable != null)
            {
                try {
                    float height = drawable.DrawOn(null)[1] + topPadding + bottomPadding;
                    if (height > cellHeight)
                    {
                        cellHeight = height;
                    }
                }
                catch (Exception) {
                }
            }

            if (text != null)
            {
                float fontHeight = font.GetHeight();
                if (fallbackFont != null && fallbackFont.GetHeight() > fontHeight)
                {
                    fontHeight = fallbackFont.GetHeight();
                }
                float height = fontHeight + topPadding + bottomPadding;
                if (height > cellHeight)
                {
                    cellHeight = height;
                }
            }

            return(cellHeight);
        }