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

Free Support Forum - aspose.com

Page Layout Question wrt ImageSaveOptions

Hi,

When calling getPageCount() on a document, this performs a full page layout on the entire document, so if my document has 1000 pages it will re-layout all 100 pages correct.

If I wish to save a document page as a JPEG with the following code:
Document doc = new Document(“MyFile.docx”)
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
options.setPageIndex(0);
options.setPageCount(5);
doc.save(“MyFile.png", options);
Will it only perform a layout on the first 5 pages or the entire document:

If I use this code:
Document doc = new Document(“MyFile.docx”)
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
options.setPageIndex(6);
options.setPageCount(10);
doc.save(“MyFile.png", options);
Assuming the first case only performs a layout on the first 5 pages can I assume even though I only want 5 pages it will need to perform a layout on the first 10 pages even though my start index is 6 as all page layouts need to start at the first page.

Thanks, Ian.

Hi Ian,


Thanks for your inquiry. We are in communication with our development team and will get back to you soon.

Best regards,
Hi Ian,

Thanks for being patient.

Please note that Aspose.Words always builds the layout for the complete document. This is irrespective of start page index or page count values. This is because a Page can have features, like fields, TOCs, etc which depend on the content rendered later in the document, e.g. forward references. Because of this complete document will always be rendered in memory.

The only exception is when source document is converted to HTML and it has text boxes which are converted to images. In this case only layout of text boxes is built, but fields (if any) are not updated, cause it's not possible in this scenario.

Best regards,