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

Free Support Forum - aspose.com

How to make PDF generation faster?

We are transforming to PDF from DOCX using following code -

final PdfSaveOptions options = new PdfSaveOptions();
options.getOutlineOptions().setDefaultBookmarksOutlineLevel(1);
try {
doc.save(“docx.pdf”, options);
} catch (Exception e) {
throw new RuntimeException(“problem while PDF.”, e);
}

Can you suggest us some ways to make it faster?

Hi Praneeth,


Thanks for your inquiry. Please note that Aspose.Words builds a ‘page layout’ of the document when you first convert a document to PDF, XPS, image or print it. Generally, Aspose.Words layouts 10 pages per second; so, the extra amount of time Aspose.Words takes to format a document into pages depends on the number of pages your Word document has. However, could you please attach your input Word document you’re getting this problem with here for testing? We will investigate the issue on our end and provide you more information.

Best regards,

If we create a LayoutEnumerator instance just before converting doc to pdf, we see the actual time for doc.save got reduced. How the LayoutEnumerator instance/object got associated with doc.save?


final PdfSaveOptions options = new PdfSaveOptions();
options.getOutlineOptions().setDefaultBookmarksOutlineLevel(1);
try {
doc.save(“docx.pdf”, options);
} catch (Exception e) {
throw new RuntimeException(“problem while PDF.”, e);
}

Hi Praneeth,


Thanks for your inquiry. This is because LayoutEnumerator builds the page layout. After you create instance of this class first, any rendering operation e.g rendering to PDF (using save method) or image will be instantaneous.

Best regards,

Hi Awais,

How Document instance is using that information, What if LayoutEnumerator instance information got garbage collected just before Document.save is being done?

Hi Praneeth,

Thanks for your inquiry. I see that you have already posted a similar query in this thread. Please follow that thread for further proceedings.

Best regards,