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

New Here ,
Apr 18, 2018 Apr 18, 2018

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

114

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 18, 2018 Apr 18, 2018

Copy link to clipboard

Copied

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 19, 2018 Apr 19, 2018

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines