Did you create a text field to hold the date? If so, create it and call it Today.
Now go to Tools and search for "document actions". Click on the item found (called "Set Document Actions") and you'll see something like this:
Select the Document Will Print item and click on Edit.
In the window that opens paste this code and then press OK:
this.getField("Today").value = util.printd("mm/dd/yyyy", new Date());
That's it, pretty much. Save the file and the next time you print it the field will be populated automatically.
Thanks for the info. It didn't work for me. I inserted a text field and called it TODAY. Do I need to look at the properties of this text box and perhaps change something there?
Then you must use:
this.getField("TODAY").value = util.printd("mm/dd/yyyy", new Date());
It's still not printing the date. In the text field - Properties - General tab, what should the "Common properties" be? Could that make a difference?
Where do you see "Common properties"? Your text field needs no special properties, just create it in the forms editor ("Prepare Form").
Just make sure that you select "Format" to "None". Then use the script that was already provided as your "Document Will Print" action. Make sure that the field name is spelled the same way in both the field's properties and the script.
1 person found this helpful
I also went to the text field properties and selected "hidden but printable" and it works perfect. The date does not appear on my document when viewing but prints current date.
Thank you very much. I've been scratching my head for 3 days trying to figure this out.