Add Annotation from top bar

PDF.js Express Version

Detailed description of issue
We are trying to add text annotations with the default tool annotations header. When I added the text per click, this xml is created:


In the content section to may “&quot” are printed.

If we move the text or change the content of the annotation, the XML is changed and printed the correct way.

Expected behaviour
We would expect the webviewer to export the annotation the right way right at the beginning and not only, when it got changed.

Does your issue happen with every document, or just one?
With every document

Code snippet

    annotManager.exportAnnotations({ links: false, widgets: false, annotList: annotList }).then( xfdfString => {

                  instance.docViewer.getDocument().getFileData({xfdfString}).then(function (data) {
                    const arr = new Uint8Array(data);
                    var blob = new Blob([arr], {type: 'application/pdf'});
                    var reader = new FileReader();
                    reader.onloadend = function () {
                      app.file.base64 = reader.result;
                      app.file.base_64_string = app.file.base64.split(',')[1];
                      app.file.atob = atob(reader.result.replace('data:application/pdf;base64,', ''));
                      app.file.file_name = app.file_name;
                      app.file.xfdf = xfdfString;

Hey there!

Thank you for catching this. We can reproduce the issue and will investigate.

I’ll keep you updated on a fix.


Hey! We found a fix and it will be fixed in the next patch. Keep an eye on #announcements.



This is fixed in 7.3.1