Issue with PDF conversion

When converting a document to PDF format using a Word header/footer template, if the Word template contains a DateNow the PDF conversion process changes the date from DateNow to the creation date of the file.

Hi,

The date is generated by Aspose.Words. I will move this thread to Aspose.Words forum. They will reply to you soon.

Hello!

Thank you for your interest in Aspose products.

I’m Viktor, the developer from Aspose.Words Team responsible for integration with Aspose.Pdf.

Do you mean you have a DATE field in the document? This behavior is currently by design. Aspose.Words can update only DOCPROPERTY and DOCVARIABLE fields by calling Document.UpdateFields method:

The known issue regarding field updating is #3292. There are two workarounds:

  1. You can re-save the document with Microsoft Word. It updates such fields on open.

  2. Here is the MS knowledge base article where a workaround is described:

See “Method 2: Create a macro to automatically update the field.”

Regards,

I guess I should explain my issue a little better. The problem I am having is that I am trying to use a word header/footer template on a PDF document. In the footer of the template there is a date field that is supposed to always be the current date. This functionality works fine when I create the document in Microsoft Word, however, when I create the document in PDF using the same template the date comes back as the date the Word Template I am using was created. From what I can tell there are three dates that could be used: Created, Modified, and Accessed. The Word document is using the Accessed date whereas the PDF document is using the Created date.

Hi again.

To be absolutely sure we mean the same please attach here your document and conversion code. I’ll see what happens with dates. You can also narrow-down the issue by minimizing the document.

Thank you,

Unfortunately I cannot post the code I am using on this forum. The steps to reproduce this issue are simple though. Simply create a microsoft word document that countains a footer with the current date in it. Then create a document in code and convert it to PDF format using the footer template created above as the documents template. The date will change. Also note that when converting the created document to Word format, the date does not change.

Hi!

We don’t ask for all your project. To figure out what happens with Aspose.Words there could be enough a fragment that calls Aspose.Words. You can send the code privately via a private message. If a date is not updated this is by design as I already wrote. I have linked your request to issue #3292. Once we address it we’ll notify you and give updates.

Regards,

Use Aspose.Words.Document.UpdateFields before saving a document. It works starting with Aspose.Words for .NET 7.0. Also use the Aspose.Words direct to PDF conversion method instead of Aspose.Words + Aspose.Pdf conversion. .