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

Free Support Forum - aspose.com

Removed paragraphs using DocumentBuilder remain when saved to PDF

I have an application that conditially removes certain paragraphs using DocumentBuilder.

When the Aspose.Words.Document is saved to PDF format, these removed paragraphs remain in the PDF.

If I save as Word format, the paragraphs are removed as they should.

Prior versions worked as they should. This is a new issue.

Hi there,


Thanks for your inquiry.

By the sounds of it you render the document before you remove these paragraphs. In this case, the rendered layout of the document is already stored in memory before you remove the paragraphs which is why when you export to PDF they appear in the output.

You can solve this issue by calling doc.UpdatePageLayout() or doc.UpdateFields() just before you call Save.

If we can help with anything else, please feel free to ask.

Thanks,