iTextSharp.text.Image.ScaleAbsolute C# (CSharp) Метод

ScaleAbsolute() публичный Метод

Scale the image to an absolute width and an absolute height.
public ScaleAbsolute ( float newWidth, float newHeight ) : void
newWidth float the new width
newHeight float the new height
Результат void
        public void ScaleAbsolute(float newWidth, float newHeight)
        {
            plainWidth = newWidth;
            plainHeight = newHeight;
            float[] matrix = this.Matrix;
            scaledWidth = matrix[DX] - matrix[CX];
            scaledHeight = matrix[DY] - matrix[CY];
            WidthPercentage = 0;
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Arma el header de los pdf en una tabla, con titulo y foto
        /// </summary>
        /// <param name="titulo">string</param>
        /// <returns>PdfTable</returns>
        public PdfPTable getHeader(string titulo)
        {
            iTextSharp.text.Font font1 = iTextSharp.text.FontFactory.GetFont(FontFactory.HELVETICA, 15);
            iTextSharp.text.Font font2 = iTextSharp.text.FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 15);

            PdfPTable tableTitulo = new PdfPTable(2);

            float[] widthsTitulo = new float[] { 10f, 3f };
            tableTitulo.SetWidths(widthsTitulo);
            tableTitulo.WidthPercentage    = 100;
            tableTitulo.DefaultCell.Border = 0;

            string rutaImagen = ConfigurationManager.AppSettings["rutaImgLogo"].ToString();

            iTextSharp.text.Image imagen = iTextSharp.text.Image.GetInstance(rutaImagen);
            imagen.Border = 0;
            imagen.ScaleAbsolute(159f, 60f);

            PdfPCell tilde = new PdfPCell(imagen, true);

            tilde.HorizontalAlignment = Element.ALIGN_RIGHT;
            tilde.FixedHeight         = 40f;
            tilde.Border = 0;

            tableTitulo.AddCell(new Paragraph(titulo, font2));
            tableTitulo.AddCell(tilde);
            return(tableTitulo);
        }
All Usage Examples Of iTextSharp.text.Image::ScaleAbsolute