Please give a brief summary of your issue:
We’re using pdfnet-node sdk to generate different type of annotations, they are running on Google Cloud function and are independent from each other. One of them are:
PDF location at top right (A0, B1, etc)
Text annotation at bottom right of each page
When I call await doc.mergeXFDFString(this.xfdf); it’s gonna throw duplicate annotation error and I have to set merge option setForce(true)
const mergeOptions = new PDFNet.PDFDoc.MergeXFDFOptions();
mergeOptions.setForce(true);
await doc.mergeXFDFString(xfdf, mergeOptions);
I find duplicate name for this one. 55deac590367400a-13b5a19c48e7aa52 and it is not showing on webviewer.
It is against the PDF specification to have two annotations on the same page with the same ID. That is, annotation IDs are unique in the page scope.
In your 446.xml you have two annotations on the same page with same ID, so your XFDF is already in a bad state.
Since this particular ID is a GUID it is not possible to have a collision randomly, so somehow the annotation was duplicated, on the same page, without updating the ID.
You would need to review how/when you are creating these annotations to determine what exact step is resulting in the duplicate annotation. For instance, exporting XFDF at each step to determine precisely what API call is causing it.
Yes you can use setUniqueID, there should be a means to create a GUID using your current language/framework. From there you should be able to find a way to convert that returned object to one that is accepted by setUniqueID.