I have a .png files which are size of A4. I am adding them to the .pdf. It is working but my image is not covering all .pdf document page and it is leaving the white edges around it. How to cover whole page with my image?
String dest = "C:\\ImagePaged.pdf";
PdfWriter writer = new PdfWriter(dest);
// Creating a PdfDocument
PdfDocument pdfDoc = new PdfDocument(writer);
// Creating a Document
iText.Layout.Document document2 = new iText.Layout.Document(pdfDoc);
// process and save pages one by one
for (int i = 0; i < 10; i++) //count of .png images
{
iText.IO.Image.ImageData imageData = iText.IO.Image.ImageDataFactory.Create($"C:\\ImagePage{i}.png");
Image image = new Image(imageData);
document2.Add(image);
}
document2.Close();
I guess I need somehow to set page edge parameters. But how to do that.
Pretty sure it is this one
pdfDoc.SetMargins(0, 0, 0, 0);