But still we are not able to retain annotation if “trn-custom-data” is present in our respone,but removing that we are able to do so.Kindly provide with some solution to overcome this problemn.
We are importing using below command,which is working.
inst.Core.annotationManager.importAnnotations(data);
We are exporting annotation response from below code:
const vv = inst.Core.annotationManager
.getAnnotationsList()
.filter((annot) => annot.Subject === "Comment");
console.log("anew", vv);
const xfdf = await inst.Core.annotationManager.exportAnnotations({
// // annotList: [inst.Core.Tools.TextHighlightCreateTool],
annotList: vv,
});
console.log(xfdf);
With trn-custom-data:
const data = `<?xml version="1.0" encoding="UTF-8" ?><xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><annots><text page="0" rect="287.070,631.750,318.070,662.750" color="#FFCD45" flags="print,nozoom,norotate" name="c41d27c6-4909-f4fa-8d1b-8f0a95d6f9ee" title="Nikhil" subject="Comment" date="D:20230424102240+05'30'" creationdate="D:20230424102224+05'30'" icon="Comment" statemodel="Review">
<trn-custom-data bytes="{"trn-mention":{"contents":"Need to Change some information","ids":[]}}"/><contents>data1</contents>
<contents-richtext><body><p><span>Change the layer
</span></p></body></contents-richtext></text><text page="1" rect="249.450,130.250,280.450,161.250" color="#FFCD45" flags="print,nozoom,norotate" name="c06f5bd3-e309-cc96-4105-5f46e07e797f" title="Nikhil" subject="Comment" date="D:20230504102056+05'30'" creationdate="D:20230504102053+05'30'" icon="Comment" statemodel="Review"><trn-custom-data bytes="{"trn-mention":"{\"contents\":\"rrrr\\n\",\"ids\":[]}"}"/><contents>rrrr
</contents><contents-richtext><body><p><span>rrrr
</span></p></body></contents-richtext></text></annots></xfdf>`;
Without trn-custom-data:
const data = `<?xml version="1.0" encoding="UTF-8" ?><xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><annots><text page="0" rect="287.070,631.750,318.070,662.750" color="#FFCD45" flags="print,nozoom,norotate" name="c41d27c6-4909-f4fa-8d1b-8f0a95d6f9ee" title="Nikhil" subject="Comment" date="D:20230424102240+05'30'" creationdate="D:20230424102224+05'30'" icon="Comment" statemodel="Review">
<trn-custom-data bytes="{"trn-mention":{"contents":"Need to Change some information","ids":[]}}"/><contents>data1</contents>
<contents-richtext><body><p><span>Change the layer
</span></p></body></contents-richtext></text><text page="1" rect="249.450,130.250,280.450,161.250" color="#FFCD45" flags="print,nozoom,norotate" name="c06f5bd3-e309-cc96-4105-5f46e07e797f" title="Nikhil" subject="Comment" date="D:20230504102056+05'30'" creationdate="D:20230504102053+05'30'" icon="Comment" statemodel="Review"><contents>rrrr
</contents><contents-richtext><body><p><span>rrrr
</span></p></body></contents-richtext></text></annots></xfdf>`;
Removed linne:
<trn-custom-data bytes="{"trn-mention":"{\"contents\":\"rrrr\\n\",\"ids\":[]}"}"/>