Extracting signature annotation once placed

Product: Web

Product Version: 8.2.0

Please give a brief summary of your issue:
The fieldChanged event gives back a list of annotations that have changed. However when I iterate through them, it doesn’t seem to find SignatureWidgets

Please provide a link to a minimal sample where the issue is reproducible:

annotationManager.addEventListener( “annotationChanged”, ( annotations, action, { imported } ) => {
if ( !imported && action === “add” ) {
const signatureWidgetAnnots = annotations.filter(
annot => annot instanceof Annotations.SignatureWidgetAnnotation,
); // EMPTY

            }
        } );

Hi,

When a signature is added using a signature widget, it’s actually adds a freehand annotation that the signature widget get a reference to. So you would want to do something like

  const { annotManager, Annotations } = instance;

  annotManager.on('annotationChanged', (annotations, action, { imported }) => {
    if (action === 'add'
      && !imported
      && annotations[0] instanceof Annotations.FreeHandAnnotation
      && annotations[0].Subject === 'Signature'){
      // get data here
    }
  });

The SigatureWidget you added the signature to will become hidden on the page and will have an annot property that points to the FreeHand annotation that was added (it’ll reappear if that freehand annotation get deleted).

Please let me know if the above helps or if you have any other questions

Best Regards,

Andrew Yip
Software Developer
PDFTron Systems, Inc.
www.pdftron.com

Thanks,

That worked for a drawn signature, which annotation type do I use for the text and image based signature?

Mario

Hi,

Text and image signature would be “Annotations.StampAnnotation” with a “Subject” property set to “Signature”.

Andrew Yip
Software Developer
PDFTron Systems, Inc.
www.pdftron.com