PDF date of print

2019-07-31 15:45发布

问题:

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?

回答1:

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());