I followed the how-to add watermarks example in the documentation to add a “DRAFT” watermark by creating a Shape and inserting it all headers, and it works as long as the document is saved in doc format. However, if I save the document in PDF format via the document.Save method, the resulting PDF does not show the watermark. I have a 9.4.0 licensed version. I downloaded and retried with 9.4.1, the problem isn’t fixed either. Please Help!
Thanks for your inquiry.
Could you please attach your template and code here and I will test the issue on my side for you.
Nevermind, the problem was that I was adding the watermarks after a call to UpdateFields() and UpdateLayout(). Forcing the watermarks to be added before these method calls, for some reason, caused the watermark to not disappear after saving in PDF format. I am not clear why when the document was saved in doc format watermarks would not disappear, but when saving to PDF watermarks would disappear. I would seem to me that the Save method should be consistent in this case. But, like I said, doing the watermarks before the UpdateLayout() seems to make the Save method work now.
Thank you for your response.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thank you for additional information. It is perfect that you found the reason of the problem and managed to resolve it.
The problem occurs because after calling UpdatePageLayout, Aspose.Words layouts document into pages and stores these pages in memory. If you insert some content into the document, content will be insert into the DOM but layout of pages will not be rebuild.