How is exportAnnotations() command different from exportAnnotCommand() for exporting annotations?

PDF.js Express Version

Detailed description of issue
On exporting annotations on viewer, which is the best way to export all the annotations made on the document ? Can u pls help us navigate through these 2 techniques?

Expected behaviour
{Provide a screenshot or description of the expected behaviour}

Does your issue happen with every document, or just one?
{Answer here}

Link to document
{Provide a link to the document in question if possible}

Code snippet
{Provide a relevant code snippet}

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:


Hi there!

At the end of the day both of these functions do the same thing, export annotations as a string. The only difference is the format that the annotations are output in.

exportAnnotations exports annotations as an XFDF string, which is the standard format for annotations in PDFs.

exportAnnotCommand exports a proprietary format that we use internally for annotations.

I recommend using exportAnnotations since it matches the PDF Standard and is easy to parse/understand/use.

Thank you!

Thanks for sharing this Logan !

1 Like