I am trying to add image to PDF document. Image size is 145x53px.
But image looks bigger in PDF document.
How to fix the issue? I need that picture will be displayed as normal size.
Code:
FileStream fs = new FileStream( "C:\\Temp\\First PDF document.pdf", FileMode.Create);
Document document = new Document(PageSize.A4, 60, 25, 30, 30);
PdfWriter writer = PdfWriter.GetInstance(document, fs);
document.Open();
// Add an image
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance("C:\\Temp\\Img\\test.png");
document.Add(img);
document.Add(new Paragraph("Original Width: " + img.Width.ToString()));
document.Add(new Paragraph("Original Height " + img.Height.ToString()));
document.Add(new Paragraph("Scaled Width: " + img.ScaledWidth.ToString()));
document.Add(new Paragraph("Scaled Height " + img.ScaledHeight.ToString()));
document.Close();
writer.Close();
PNG:
PDF: