I want to increase the pages size of a pdf, but I can't figure out how. I was thinking It would be something like:
NewPDF = (OLDPDF.Page.Height+10, OLDPDF.Page.Width+10)'
Here is my code to create new pdf and edit it:
Code:
PdfDocument PDFDoc = PdfReader.Open(@"C:\Users\oldpdf.pdf", PdfDocumentOpenMode.Import);
PdfDocument PDFNewDoc = new PdfDocument();
string name = "name";
for (int Pg = 0; Pg < PDFDoc.Pages.Count; Pg++)
{
//PDFDoc.Pages[Pg].Width = PDFDoc;
PDFNewDoc.AddPage(PDFDoc.Pages[Pg]);
XGraphics gfx = XGraphics.FromPdfPage(PDFNewDoc.Pages[Pg]);
XFont font = new XFont("Arial", 10, XFontStyle.Regular);
gfx.DrawString("HI", font, XBrushes.Black, new XRect(0, 0, PDFDoc.Pages[Pg].Width, PDFDoc.Pages[Pg].Height), XStringFormats.BottomCenter);
gfx.DrawString("Hello", font, XBrushes.Black, new XRect(-2, -2, PDFDoc.Pages[Pg].Width, PDFDoc.Pages[Pg].Height), XStringFormats.BottomRight);
gfx.Dispose();
}
PDFNewDoc.Save(@"C:\Users\Newpdf.pdf");
I want to set page size for the new pdf to be larger then the oldPDF.
Thank you.