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

Free Support Forum - aspose.com

Saving Document to PDF truncating last section

We’re creating a new Aspose.Words.Document by combining snippets extracted from Docx templates/files located on disk.

The Aspose.Words.Document is saved as a Docx, Rtf and Pdf. Both the Docx and Rtf save correctly with all sections and pages included. The Pdf always truncates the last section of the Document.

I’ve attached an example of a Docx and Pdf saved from the same Aspose.Words.Document.

Notice the following:
- the Docx contains 13 pages whereas the Pdf contains 12
- Page 13 in the Docx has a section break w/ page break
- when I open the Docx in Word and save it to a Pdf with Word, I receive all 13 pages

No matter the order of the snippets in the new Aspose.Words.Document, the last section is always truncated when saving as Pdf.

This appears to be a defect but maybe you can provide a workaround or explain what I need to do to rectify.

Update May 18, 2014: I found mention of the UpdatePageLayout method and ended up trying it. This seems to have resolved the issue. Is this the recommended approach to rectify the issue I described?

Thanks you.

Hi Vincent,

Thanks for your inquiry. Yes, please call Document.UpdatePageLayout method before saving to PDF format. Please refer to the answer of last question in the following link:

Best regards,