Which product are you using?
Am using PDF.js Express Plus
Detailed description of issue
Am working on pdf xxpress js plus for annotations, am abl to export annotations(underline and comment), by using “instance.Core.annotationManager.exportAnnotations”, it is successfully exporting into xfdf format and am locally storing it. when am importing by using instance.Core.annotationManager.importAnnotations(xfdfString); back the annotation it is loading a fresh file not the annotated part ie my annotation text is not coming
Expected behaviour
once annotation is done and exported am saving to local storage, and when i try to import the annotated paragraph ie retriving the locally stored xfdf format, am not finding any annotations, document is loading freshly
Does your issue happen with every document, or just one?
Yes Every Document
Link to document
{Provide a link to the document in question if possible}
Code snippet
useEffect(() => {
WebViewer(
{
path: '/webviewer/lib',
},
viewer.current,
).then(async instance => {
var myAnnotations = localStorage.getItem("Annotations");
const {Core} = instance;
instance.UI.loadDocument('https://www.corenet.gov.sg/media/2268607/dc19-07.pdf');
Core.documentViewer.addEventListener('documentLoaded', async () => {
const xfdfString = await myAnnotations
instance.Core.annotationManager.importAnnotations(xfdfString);
});
//For Pop Up
instance.UI.contextMenuPopup.add({
type: 'actionButton',
label: 'Export',
onClick: async () => await saveToDatabase(xfdfString, instance),
});
});
}, []);
function saveToDatabase(x, y) {
//Saving Annotations to Local Storage as on now
//Here x is the xfdfString(Annotated string)
//Here y is the instance
localStorage.setItem("Annotations", x);
}