WebViewer Version: 11.7.1
Do you have an issue with a specific file(s)?
Can you reproduce using one of our samples or online demos?
Are you using the WebViewer server?
Does the issue only happen on certain browsers?
Is your issue related to a front-end framework?
Is your issue related to annotations?
Please give a brief summary of your issue:
Notes Panel Shows Incorrect Annotation Count When Importing XFDF in Chunks Using importAnnotationCommand
Please describe your issue and provide steps to reproduce it:
When loading annotations from the database in chunks and importing XFDF using annotationManager.importAnnotationCommand, the Notes panel displays a higher annotation count than the number of annotations actually rendered on the document.
Example:
-
API returns 50 annotations
-
Only 50 annotations are visually rendered
-
Notes panel shows 75 / 200+ comments
Expected Behavior
-
Notes panel count should match the number of unique annotations imported and rendered.
-
Importing 50 annotations should result in 50 notes.
Actual Behavior
-
Notes panel count increases unexpectedly.
-
The count jumps by tens or hundreds, even though only a few annotations are visible on the page.
-
This happens specifically during chunked XFDF imports.
Key Findings (Important)
After investigation, we found:
-
importAnnotationCommand()does not guarantee a 1:1 mapping between:-
One XFDF input
-
One annotation object created
-
-
Some XFDF commands appear to:
-
Replay
<add>or<modify>operations -
Re-apply changes to existing annotations
-
Create additional internal annotation objects
-
-
As a result:
-
The document visually shows the correct annotations
-
The Notes panel counts all internal annotation objects, including duplicates or overwritten ones
-
-
Concatenating multiple XFDF strings into a single call significantly amplifies the issue and causes massive inflation in Notes panel count.
What Does NOT Work
-
Concatenating multiple XFDF strings into one
importAnnotationCommand -
Skipping
importAnnotationCommandand trying to manipulate XFDF directly -
Applying styles without importing annotations into
annotationManager
importAndStyleChunk: async function (annotations) {
const self = this;
self.showAnnotationLoader();
const annotationManager = window.webViewerInstance.Core.annotationManager;
for (const a of annotations) {
const importedAnnots = await annotationManager.importAnnotationCommand(a.annotData);
importedAnnots.forEach(annot => {
annot.setContents(a.text);
self.applySecuritySettings(annot);
annotationManager.redrawAnnotation(annot);
});
await new Promise(resolve => requestAnimationFrame(resolve));
}
},
Please provide a link to a minimal sample where the issue is reproducible: