Annotations are placed in the wrong place for linearized PDF in Webviewer

WebViewer Version:10.0.0

Do you have an issue with a specific file(s)? - No.
Can you reproduce using one of our samples or online demos? - No.
Are you using the WebViewer server? - No.
Does the issue only happen on certain browsers? - No.
Is your issue related to a front-end framework? - No.
Is your issue related to annotations? - Yes.

Please give a brief summary of your issue:

We are rendering webviewer with client side code of this.

We are rendering 300 MB linearized PDF in webviewer. After that scroll to last page and add annotations like this.

After that save annotations into local storage like below.

Again page load and rendering saved annotations like below.

Code used for this.

Imported annotations are rendering different places. This issue occurs only for linearized PDFs only.

Please help me to fix this issue.

Please describe your issue and provide steps to reproduce it:

  1. Load 300 MB linearlized PDF.
    2.Add custom button in the header.
    3.Scroll last page in pdf to add annotation and click save button to export annotation in local storage.
    4.Again page load to render saved annotation. And scroll last page to see annotations, they were placed in different places.
1 Like


I tried to generally reproduce your issue and I was not able to. From looking at your import code though, you should not be importing the annotations at that point in time. The setDocumentXFDFRetriever API is meant to retrieve XFDF, not import it (only automatically after it returns). Once you have gotten the XFDF, you should just return it. Also, importAnnotations is async so it does return a promise and not an XFDF string.

It should just look something like this:

documentViewer.setDocumentXFDFRetriever(() => {
    return localStorage.getItem('annotations');

Perhaps give that a try and let me know how it goes!

1 Like