Copy link to clipboard
Copied
I have been using
event.value = util.printd('m/d/yyyy h:MM tt', new Date());
to display the date and time printed on my documents. It used to work displaying the current date and time but now it does not update but prints the date and time created.
Printing the file will not trigger this code. You should move it to the Will Print event of the document, or add a call there to the calculateNow method.
Thnak you, I used the document "Will Print" event in JavaScript as shown by Try67 and my issue has been resolved. Thaks all.
Copy link to clipboard
Copied
Where does you use the script?
Copy link to clipboard
Copied
In scanned document - prepare forms, image field, date and time. Formula added to the calculate field.
Copy link to clipboard
Copied
Printing the file will not trigger this code. You should move it to the Will Print event of the document, or add a call there to the calculateNow method.
Copy link to clipboard
Copied
I am unable to locate the "Will Print" event of the document. However, using my previous approach I have inconsistent results. It works sometimes but not always.
Copy link to clipboard
Copied
Does you use Acrobat Standard or Pro.
Copy link to clipboard
Copied
I think Try67 is referring to the document actions .
You need to go to tools and select the "JavaScript" tool to get to the document eventss.
Copy link to clipboard
Copied
I am using Adobe Acrobat Pro DC. What properties of a document would interfere with the formula?
event.value = util.printd('m/d/yyyy h:MM tt', new Date());
It works with some of my scanned documents but not with others.
Copy link to clipboard
Copied
Where did you place the code?
Copy link to clipboard
Copied
Prepare Form, Date Field, Properties, Calculate, Custom calculate script.
Copy link to clipboard
Copied
Then it should work fine, but it will not update just by opening the file...
Copy link to clipboard
Copied
In some documents it updates automatically when opened, with others it always print the date and time the script was entered and never updates unless it is re-entered. How can I get it to update automatically?
Copy link to clipboard
Copied
Use the document will print event.
Copy link to clipboard
Copied
Thnak you, I used the document "Will Print" event in JavaScript as shown by Try67 and my issue has been resolved. Thaks all.