Which product are you using?
PDF.js Express Plus
PDF.js Express Version
8.7.2
Detailed description of issue
I am using PDF.js Express Plus version 8.7.2 with the annotation feature enabled. My goal is to:
- Save annotations drawn on the viewer to a database.
- Load annotations back into the document from the database when revisiting the document.
I am using the following code for importing and exporting annotations:
Loading Annotations from Database:
javascript
Copy code
// After the document is loaded, we load the annotations from the database
instance.Core.documentViewer.addEventListener('documentLoaded', async () => {
const xfdfString = await loadXFDF(docId);
await instance.Core.annotationManager.importAnnotations(xfdfString);
});
Saving Annotations to Database:
javascript
Copy code
// When the "save" button is clicked, we export
// the annotations and save them to the database
saveButton.onclick = async () => {
const xfdfString = await instance.Core.annotationManager.exportAnnotations();
await saveToDatabase(docId, xfdfString);
};
Questions:
- Are
exportAnnotations
andimportAnnotations
API-dependent calls, or are they strictly handled on the client side?
Specifically, do they require API usage credits, or are they independent of API limits? - Is there a limit on the size or complexity of annotations when using
exportAnnotations
andimportAnnotations
?
Will exporting a large number of annotations or importing a large XFDF string impact the viewer’s performance or cause any issues? - Are there any recommended best practices for handling large XFDF strings when saving to and loading from the database?
Expected behaviour
- The annotations should export as an XFDF string without any API limitations or size restrictions and should load back correctly into the viewer without performance degradation.
Does your issue happen with every document, or just one?
This is a general question, applicable to any document.
Link to document
N/A
Code snippet
Provided above.