Free Support Forum - aspose.com

Increasing the height of existing PDF document

I have an existing PDF document with content. Can i increase the height of this document to A4 so that i can insert header and footer which are images in my case and save as output document with header & footer.

Hi Srikanth,


Thanks for using our products.

We have a class named PdfPageEditor present under Aspose.Pdf.Facades namespace which provides the capability to manipulate the pages of existing PDF document. Please try using the following code snippet to accomplish your requirement.

[C#]

//open document<o:p></o:p>

Document pdfDocument = new Document("source.pdf");

//get page collection

PageCollection pageCollection = pdfDocument.Pages;

//get particular page

Page pdfPage = pageCollection[1];

// set the page size as A4 (11.7 x 8.3 in) and in Aspose.Pdf, 1 inch = 72 points

// so A4 dimensions in points will be (842.4, 597.6)

pdfPage.SetPageSize(597.6,842.4);

// save the updated document

pdfDocument.Save("Updated.pdf");


PS, Please note that Height and Width properties use Point as basic unit, where 1 inch = 72 points and 1 cm = 1/2.54 inch = 0.3937 inch = 28.3 points.