Copy link to clipboard
Copied
I have a pdf that has a dynamic date field. The date field works great until I password protect the document and than it no longer works. Is there a way to still have the dynamic date field work AND have a password protected document? I need to password protect it so no one can make any changes to the document. I also need to it always have "todays date" displayed.
Copy link to clipboard
Copied
You have to allow the filling-in of form fields in your policy for it to
work.
On Thu, Apr 6, 2017 at 3:47 PM, kimh20816669 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
I have additional form fields in the pdf that need to be locked and un-editable by others.
Copy link to clipboard
Copied
Then set them as read-only, but that setting must be enabled for the script to be able to change the value of your field.
Copy link to clipboard
Copied
Got it! THANK YOU!
Copy link to clipboard
Copied
Another quick question if anyone has an answer. When using a dynamic date field, is there a way to do it so that if a person opens your document and saves it, it saves with the date they saved the document and no longer updates. If that makes sense.
Copy link to clipboard
Copied
Put the code under the Will Save event of the document (Tools - JavaScript - Set Document Actions) and add to it an if-condition that it should only populate the field if it's empty.
Copy link to clipboard
Copied
This is the code I put in, but it is still changing after I save the document elsewhere.
var f = this.getField("Today");
f.value = util.printd("mmm/d/yyyy", new Date());
Copy link to clipboard
Copied
Use this code:
var f = this.getField("Today");
if (f.valueAsString=="") f.value = util.printd("mmm/d/yyyy", new Date());
Copy link to clipboard
Copied
I added this code to my document and it isn't working as I had hoped.
When I have this code in, the dynamic date field stays the same and doesn't update from day to day.
What I am hoping to do is have a dynamic date field in a pdf the always shows todays date. However, if someone SAVES the pdf to their computer, I want it to save with the date they saved the document so if they open in 2 days later, it still shows the old date when they saved it.
Is this possible?
Copy link to clipboard
Copied
No. Saving the file to one's computer does not trigger any events in it. If you want to do that then you need to do it server-side, before sending them the file.
Copy link to clipboard
Copied
At the Will Save event store the date in a hidden field. In your field "Today" use the date of the hidden field or the current date.