How to add date stamps to PDF forms using Acrobat X or XI

Learn how to insert date stamps to fillable PDF forms that will only appear when an end user prints your PDF form.

By December 13, 2011

 



In this tutorial, learn how to insert date stamps to fillable PDF forms that will only appear when an end user prints your PDF form using Acrobat X or XI. When designing a form in Acrobat X or XI Std. or Pro., there may be times when you want to know the date that a user completes or prints a form.

This is a simple two-step process that starts by clicking the Tools Pane, Forms panel, and selecting the Edit command. We'll begin by adding a New Text Field to hold the actual date. And give it a name. In this example, I’ll call mine DatePrinted. In the Properties dialog select Hidden from the Common Properties and check the Read Only box. Now we're going to exit Form Editing mode.

In the second part, we’ll be using a simple JavaScript to add the current date, which is based on the computer system clock. So we’ll open the JavaScript panel located under the Tools pane. And if you don’t see this panel, look under the small flyout menu at the top of the Tools pane. Select the Set Document Actions from the JavaScript panel, and click on the Document Will Print action, since we want the date to appear when the form is printed, and click the Edit command. In the JavaScript editor type the following code:

   var f = this.getField("DatePrinted");
        f.hidden = false;
        f.value = "Printed on: " + util.printd("mmm dd, yyyy", new Date());

In this simple three line script, we first assign variable f to the field where we are adding a new date. And then in the second line we show the field since it's initially hidden and then in the third we add the actual date. Now to test out this functionality, I’m going to go ahead and print my form to PDF and then view the resulting file. Here you can see our read-only date stamp, printed on a new document.


Did you know?

  • You can ask a question and get an answer from one of our experts.
  • You can search our database of over 800 tutorials by product and/or topic.
  • You can leave a comment below for the author of this tutorial.

Products covered:

Acrobat XIAcrobat X

Related topics:

PDF Forms

Top Searches:

Convert existing forms to fillable PDFs, fill and sign any form