Getting highlight's text upon import

Product: WebViewer

Please describe your issue and provide steps to reproduce it:

I’m adding an import button for the WebViewer which is supposed to extract the text of all highlights. But it seems that the text is not a part of the annotation. The code below makes a button and on click it goes through all annotations and if an annotation was done outside of the WebViewer it is going to delete and redraw it. I want to extract the text of those annotations.

instance.UI.setHeaderItems(header => {

        header.push({

          type: 'actionButton',

          img: 'https://img.icons8.com/material/24/000000/download--v1.png',

          onClick: () => {

            const annots = annotManager.getAnnotationsList();

            //List of all external (previously existing; to import) annotations
            let externalAnnot = [];
            annots.forEach((annot) => {
              if (!annot.getCustomData('internal') && annot.Subject != null) {
                annot.setCustomData('internal', true)
                externalAnnot.push(annot)
              }
            });

            externalAnnot.forEach((annot) => {
              annotManager.deleteAnnotation(annot);
              annotManager.addAnnotation(annot);
              annotManager.drawAnnotationsFromList(annot);
              
          }

How can I get the text of externalAnnot?

When highlighting on the WebViewer itself, it automatically extracts the text of the highlight and sets it as the Content of the annotation. But here, drawing/redrawing the highlight will not do that.

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi c3founder,

Can you please send a document that has these text highlights? I will look into it further.

Best Regards,
Ahmad Moaaz
Software Developer
PDFTron Systems, Inc.
www.pdftron.com