Skip to main content
Known Participant
May 18, 2023
Question

Adding time stamp to PDFs

  • May 18, 2023
  • 1 reply
  • 3037 views

Hi all,

We have a website where we upload PDFs in which users can open, download, print, etc. I would like to add a time stamp to the PDFs that effectively stamps the document with the date when it is opened. That part is easy.....the tricky part is we want the time stamp to not change after it's downloaded. In other words, if I'm a user and I open the PDF today, it will have today's date stamped on it. If I download it today and open it a week from now on my PC I want it to still have the same date I downloaded it. Does that make sense? Is there a javascript for that?

This topic has been closed for replies.

1 reply

try67
Community Expert
May 18, 2023

Are you doing it using a script, currently? If so, you need to change it so that it only populates the field if it's empty.
If you post the code we can help you adjust it. If you're doing it differently please specify how.

PSURAMAuthor
Known Participant
May 18, 2023

Yes. So right now I am using a script to generate the date and then I make it read only. What I would love is if I could add script that would "lock" the date (keep it from changing) if it is saved/downloaded. In other words, if a user downloads the PDF from the site and saves it to their phone/PC, then opens it a week later, the date is the same as when they downloaded it. Right now it would changes to the current day. 

 

Here is the script I'm using:

var f = this.getField("Date1_af_date");f.value = util.printd("mm/dd/yyyy", new Date());

 

try67
Community Expert
May 19, 2023

Change the second line to:

if (f.valueAsString=="") f.value = util.printd("mm/dd/yyyy", new Date());