1

Is it possible to show the date/time of viewing/printing of a PDF document?

I guess it has to involve Adobe Java Script but I'm not entirely sure this is at all possible.

I do have Acrobat X Pro and I can be sure the pdf will be opened with Acrobat Reader 9 or Acrobat reader X.

Embedding some other information would definitively be a plus (like the path the document or the name of the author as it is stored in the PDF properties).

Anyone already did something similar?

Remo.D
  • 16,122
  • 6
  • 43
  • 74
  • I assume you want to have the date+time appear on the printout pages. Is this correct? – Kurt Pfeifle Apr 27 '12 at 16:05
  • Yes. Actually I would like the date+time (and the value of property "author" as very minimum) appearing on the page when the file is opened. Refreshing date+time before printing is good but not strictly necessary. – Remo.D Apr 27 '12 at 17:53

1 Answers1

3

Yes, it is possible using Acrobat JavaScript. You create a text field on the page at the location where you want the date/time to appear and set its visibility to HiddenButPrintable. Then add a DocumentBeforePrint action and write the javascript code that sets the field value to current date/time. The action will be executed before the document is printed. This works in Adobe Reader and Acrobat but if you print the document with some tool that does not support JavaScript, the date/time will not appear.
The code for the before print action looks something like this:

getField("yourfield").value = util.printd("yyyy/mm/dd",new Date());
iPDFdev
  • 5,229
  • 2
  • 17
  • 18
  • Thanks, is the event Doc/WillPrint the one you're referring to? I've not been able to find "DocumentBeforePrint" in the "Adobe JS API reference" document. – Remo.D Apr 27 '12 at 17:57
  • Yes, I meant the Doc WillPrint event. If you want to set the date/time when the document is opened you set the document Open action. – iPDFdev Apr 30 '12 at 07:06