Expand my Community achievements bar.

SOLVED

Adding time stamp to PDFs

Avatar

Level 1

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

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.

Avatar

Level 1

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

Avatar

Community Advisor

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