How to change pdf page size from A3 to A4 and save it using PDFTron

Product: PDFTron

Product Version: 9.1

Please give a brief summary of your issue:
How to change pdf page size from A3 to A4 and save it using PDFTron

Please describe your issue and provide steps to reproduce it:
I have PDF files with different sizes like some PDFs are in A5 and some PDFs are in other size. All PDFs contains only one page. I have to loop through all these PDFs and check the page size and if it is not in A3 size then I have to change the page size to A3 and save the PDF in output folder.

Can someone shed some light on how to achieve this using PDFTron (PDFNet.dll)


Hello Sravan;

Yes, you can scale pages using the pdftron.PDF.Page.Scale() method. This will allow you to rescale the page, including all content, which should let you scale the page down properly.

You may also be interested in some of the other methods available such as Page.SetCropBox() and Page.SetMediaBox() as these can help you further adjust the page while not necessarily needing to scale content, such as if you have extra unnecessary margins you want to shave off.

Alternatively, another user looking to do the same thing ultimately decided to modify the sample here; PDFTron Systems Inc. | Documentation

This sample shows you how to import pages into a new document, and allows you to apply a scale to the pages as you import them using the element.GetGState().SetTransform method.

Best Regards;
-James Coe