How to disable widgets and links using exportAnnotCommand

PDF.js Express Version
7.3.3

Detailed description of issue
I’m trying to remove the links and widgets from the xfdfString when I call exportAnnotCommand(), I see there is a way to do this in exportAnnotations(), however I cannot use this one because I am building a realtime collaboration page. Is it possible in version 8?

Expected behaviour
Only provide the add/modify/delete in the xml string for the specific annotation, not links.

Code snippet

annotManager.exportAnnotCommand().then(xfdfString => {
            fetch('url-to-database', {
              method: 'POST',
              headers: {
                'Content-Type': 'application/urlformencoded',
              },
              body: xfdfString
            });
          });

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:

Hey there!

We do not have a dedicated API for this currently, however there is a “hack” to work around it.

exportAnnotCommand only exports annotations that have changed, so we can set the annotations you don’t want exported to “not changed” state.

To do this, call this code right before you call exportAnnotCommand

const fieldManager = annotManager.getFieldManager()
fieldManager.getFields().forEach(field => field.IsModified = false)

I hope this helps!
Logan

Great thanks Logan I will give this a try!

1 Like