Skip to main content
Participant
April 18, 2018
Question

How do I create variable data (today's date) that updates each time the document is opened?

  • April 18, 2018
  • 2 replies
  • 632 views

Hello,

I need to create a PDF document that has a date that updates each time the document is opened.

The document can be created in indesign, but the end user will not have access to indesign, therefore it has to be updated automatically in Acrobat.

Thank you,

Travis

This topic has been closed for replies.

2 replies

Inspiring
April 19, 2018

Example Acrobat JavaScripts has the code and example PDFs. The description of how to add the code is outdated but the examples continue to work and are accessible through Prepare Forms => More => Document JavaScripts or through the JavaScript tool.

Thom Parker
Community Expert
Community Expert
April 18, 2018

Add a text field to the PDF. Let's say the name of this text field is "CurrentDate". Add this code to a Document Level Script

this.getField("CurrentDate").value = util.printd("mm/dd/yyyy", new Date());

Here's an article on document level scripts:

Basic Document Level (Document Open) Scripts

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often