We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Set PDF Dimensions and Margins

Im working with DOM for PDFs and I am inquiring how to be able to set the page size to A4 landscape and have margins all around at 1/4 inches? Note I am working with variable-page PDFs and not static-page PDFs.

Hi Junmil,

Thanks for your inquriy. You can set page dimensions and margins while creating the page as following. Hopefully it will help you to accomplish the task. However if you find any issue then please share your sample code here, so we will look into it and guide you accordingly.

com.aspose.pdf.Document doc = new

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

// so A4 landscape dimensions in points is (842.4, 597.6).

Page page= doc.getPages().add();



MarginInfo marginInfo = new MarginInfo();






Please feel free to contact us for any further assistance.

Best Regards,