• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Views

423

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
Community Expert ,
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

Votes

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.

Votes

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