Adding time stamp to PDFs | Community
Skip to main content
May 21, 2023
Solved

Adding time stamp to PDFs

  • May 21, 2023
  • 2 replies
  • 1301 views

Hi all,

We have a challenge where we're being requested to time stamp PDFs that we upload to AEM. Currently, I have written a script in Acrobat that adds the date automatically when the PDF is first opened (as long as the form is cleared before uploading). Problem is, it only works for the very first time it's accessed. Everyone that accesses it afterwards sees the same date (the first date it was opened). What I want to happen is every user that accesses it from a different IP address to see the current date. Is that possible in AEM?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by MayurSatav

Hi @psuram ,

Yes, it is possible to dynamically add a timestamp to PDFs uploaded to AEM. However, it requires a different approach than using a script in Acrobat. You can achieve this by using AEM's capabilities to modify and render PDFs on the server side.

Here's a high-level overview of how you can implement this:

  1. Create a custom workflow in AEM to handle the PDF upload process. This workflow will be triggered when a PDF is uploaded to AEM.

  2. Within the custom workflow, add a step to modify the PDF and add the timestamp. You can use a custom workflow step or an existing out-of-the-box step, such as the "Modify PDF" step provided by AEM Forms.

  3. In the workflow step, use a server-side PDF manipulation library, such as Apache PDFBox, to add the timestamp to the PDF. You can write custom code to open the PDF, add the timestamp to the desired location, and save the modified PDF.

  4. Once the PDF is modified and saved, continue the workflow to store the modified PDF in AEM.

2 replies

MayurSatav
Community Advisor and Adobe Champion
MayurSatavCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
May 22, 2023

Hi @psuram ,

Yes, it is possible to dynamically add a timestamp to PDFs uploaded to AEM. However, it requires a different approach than using a script in Acrobat. You can achieve this by using AEM's capabilities to modify and render PDFs on the server side.

Here's a high-level overview of how you can implement this:

  1. Create a custom workflow in AEM to handle the PDF upload process. This workflow will be triggered when a PDF is uploaded to AEM.

  2. Within the custom workflow, add a step to modify the PDF and add the timestamp. You can use a custom workflow step or an existing out-of-the-box step, such as the "Modify PDF" step provided by AEM Forms.

  3. In the workflow step, use a server-side PDF manipulation library, such as Apache PDFBox, to add the timestamp to the PDF. You can write custom code to open the PDF, add the timestamp to the desired location, and save the modified PDF.

  4. Once the PDF is modified and saved, continue the workflow to store the modified PDF in AEM.

PSURAMAuthor
May 22, 2023

Thank you! I will speak with our developers and see if we can make it work. 

Vijay_Katoch
Community Advisor
Community Advisor
May 22, 2023

I think in the init event, the script should always take the current date from the system.