Free Support Forum -

Update Print Date Fields in Header Footer of Word Document when Saving to PDF or HTML Fixed - Java


When saving a Word document as HTML (or as PDF) that has a [PrintDate] field, it only updates the [PrintDate] field that is in the document. If it is positioned in the header or footer it is never updated.

See included file PrintDate.docx (15.1 KB).

The result when saving as fixedhtml is image.png (5.2 KB)


After an initial test with the licensed latest (21.5) version of Aspose.Words for Java, we were unable to reproduce this issue on our end. We used the following simple code snippets on our end for testing:

Document doc = new Document("C:\\Temp\\PrintDate.docx");"C:\\Temp\\awjava-21.5.pdf");

Document doc = new Document("C:\\Temp\\PrintDate.docx");
HtmlFixedSaveOptions htmlFixedSaveOptions = new HtmlFixedSaveOptions();"C:\\Temp\\awjava-21.5.html", htmlFixedSaveOptions);

So, we suggest you to please upgrade to the latest (21.5) version of Aspose.Words for Java.


After some more testing, I’ve found that the error occurs when the following method is executed before saving:


If I remove that line it does seem to work.


It is great that you were able to workaround this problem on your end. Please let us know any time you may have any further queries in future.


I’m afraid this is not a workaround. We really need to update the pageLayout.
Is there a way to ensure the PrintDate is correct even after calling updatePageLayout?


We have logged this problem in our issue tracking system with ID WORDSNET-22351. We will further look into the details of this problem and will keep you updated on the status of linked issue. We apologize for your inconvenience.