Free Support Forum -

Setting the dimension of the PDF page to be generated


Can iset the dimensions of the PDF page to be generated from doc,docx,rtf etc via the Document or the PDFOptions objects. If yes, how? My code snippet is as follows:

public boolean convert(String fileName){

Document doc;

outputFileName = fileName+".pdf";

try {

doc=new Document(fileName, format , null);

PdfOptions options = new PdfOptions();



doc.saveToPdf(0, 1, outputFileName, options);

} catch (Exception e) {

System.out.println("Exception occurred while file conversion to pdf.");



return false;


I am getting the PDF page with a standard size of

Height= 792.0 Width= 612.0 for all formats(doc, docx).


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Aspose.Words uses the same page size as specified in MS Word document. Please see PageSetup:

So in order to change paper size in the output PDF, you should loop through all Sections in MS Word document and change paper size of each Section. But you should note, in this case, layout of the document can be changed.

Best regards.