# Activate SignatureWidgetAnnotation programmatically

**URL:** <https://pdfjs.community/t/activate-signaturewidgetannotation-programmatically/1709>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [May 25, 2022, 8:38pm UTC](https://pdfjs.community/t/activate-signaturewidgetannotation-programmatically/1709 "2022-05-25T20:38:06Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![vicente](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@vicente](https://pdfjs.community/u/vicente)\
**Post date:** [June 7, 2022, 2:16pm UTC](https://pdfjs.community/t/activate-signaturewidgetannotation-programmatically/1709/15 "2022-06-07T14:16:48Z")

</div>

Hello, Tyler!

The code snippet helped me a lot. Thank you so much! I was also needing to resize the `annotation` and now I can.

But it still doesn’t work like the normal flow of clicking the `widget`. For that, I did two more things:

1. I hid the widget after adding the annotation

```javascript
signatureTool.addEventListener('signatureReady', async (annotation) => {
   ... // your code here
   signatureWidget.innerElement.style.display = 'none';
});

```

1. Listen for the delete annotation event and shows the widget again

```javascript
annotationManager.addEventListener(
   'annotationChanged',
   (annotations, action) => { 
      if (action === 'delete') {
         const signatureWidget = annotationManager
            .getAnnotationsList()
            .find( (annot) =>
               annot instanceof Annotations.SignatureWidgetAnnotation &&
               annot.getAssociatedSignatureAnnotation()?.Id === annotations[0].Id);

         signatureWidget.innerElement.style.display = 'block';
      }
   },
);

```

I believe the problem is now resolved.  
Thanks a lot again, it helped me a lot to get to know PDF.js Express better.

Best regards,  
Vicente!

---

_[View the full topic](https://pdfjs.community/t/activate-signaturewidgetannotation-programmatically/1709)._
