# Automated timestamp on Signature

**URL:** https://pdfjs.community/t/automated-timestamp-on-signature/3620
**Category:** Technical Support
**Created:** [March 5, 2025, 4:58pm UTC](https://pdfjs.community/t/automated-timestamp-on-signature/3620 "2025-03-05T16:58:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chris1](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@chris1](https://pdfjs.community/u/chris1)
#### Post date: [March 5, 2025, 4:58pm UTC](https://pdfjs.community/t/automated-timestamp-on-signature/3620/1 "2025-03-05T16:58:39Z")

</div>

**Which product are you using?**  
PDF.js Express Plus

**PDF.js Express Version**  
8.7.0

**Detailed description of issue**  
Is there anyway to automatically or programmatically apply a timestamp at the time someone clicks sign on a PDF document?

**Expected behaviour**

**Does your issue happen with every document, or just one?**

**Link to document**

**Code snippet**

---

<div class="post-metadata">

### Author: ![darian.chen](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@darian.chen](https://pdfjs.community/u/darian.chen)
#### Post date: [March 5, 2025, 7:12pm UTC](https://pdfjs.community/t/automated-timestamp-on-signature/3620/3 "2025-03-05T19:12:42Z")

</div>

Hello Chris,

Do you have an example image and document you could provide? Where would you like the timestamp to be placed with respect to the signature?

---

<div class="post-metadata">

### Author: ![chris1](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@chris1](https://pdfjs.community/u/chris1)
#### Post date: [March 5, 2025, 9:06pm UTC](https://pdfjs.community/t/automated-timestamp-on-signature/3620/4 "2025-03-05T21:06:42Z")

</div>

No I don’t, I was look for a simple example of how it could be done. We’re pretty flexible but the requirement is that on sign of a signature field in a PDF that a label or something gets dropped off with the date time that isn’t editable by the user. Anything of that nature would work. If need be it could just be below signature or at the bottom of the page.

---

<div class="post-metadata">

### Author: ![darian.chen](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@darian.chen](https://pdfjs.community/u/darian.chen)
#### Post date: [March 6, 2025, 2:51pm UTC](https://pdfjs.community/t/automated-timestamp-on-signature/3620/5 "2025-03-06T14:51:19Z")

</div>

Hello Chris,

Here is an example that adds a free text annotation underneath a signature. It locks the free text so it cannot be modified. Feel free to make any changes.

```javascript
      annotationManager.addEventListener('annotationChanged', annotations => {
        if (annotations[0].Subject === 'Signature' && !annotations[0].isGrouped()) {
          const annotation = annotations[0];
          const textAnnot = new Annotations.FreeTextAnnotation(); // create free text annotation
          textAnnot.PageNumber = annotation.PageNumber; // set page number equal to stamp's page number
          textAnnot.X = annotation.X; // set x position equal to stamp's x position
          textAnnot.Y = annotation.Y + annotation.Height; // set y position to be below the stamp

          // set height, width and author of the free text annotation
          textAnnot.Width = annotation.Width;
          textAnnot.Height = 20;
          textAnnot.Author = annotation.Author;

          textAnnot.setContents(`Date: ${new Date().toLocaleString()}`); // set date
          textAnnot.Locked = true; // make it read-only
          annotationManager.addAnnotation(textAnnot);
          annotationManager.redrawAnnotation(textAnnot);

          annotationManager.groupAnnotations(textAnnot, [annotation]); // group annotations so they can be moved together
        }
      });

```
