How to trigger the signature modal programmatically instead of using the SignatureWidgetAnnotation

Product: Webviewer

Product Version: 8.0.1

Please give a brief summary of your issue:

I have a FreeTextAnnotation annotation with a custom popover menu, where the user can select a signer for a field. Today, when the user selects themselves as a signer, the custom annotation is converted to a SignatureWidgetAnnotation which the user must click in order to trigger the signature modal.

Instead, I’d like to open the signature modal right away when the user assigns themselves to sign. But I’m not seeing anything in the PDFTron docs about how to trigger the signature modal programmatically. Is there a way to trigger it without requiring the user to click on a SignatureWidgetAnnotation?

Hi,

You can try instance.UI.openElement('signatureModal'). Thanks.

Wanbo

Hi @Wanbo_Li, thanks for your response.

It looks like when I use openElements, the signature that the user creates follows the users cursor around until dropped.

Is there a way to make the signature being assigned to a specific SignatureWidgetAnnotation as soon as it’s created (rather than the user having to manually drop it onto the page)?

Hi,

You can listen to the “annotationChanged” event and do things like showing the signature modal when an annotation is created.

  instance.Core.annotationManager.on('annotationChanged', (annotations, action) => {
    if (action === 'add') {
      console.log(annotations);
    }
  });

Thanks.

Wanbo