Overwrite annotations to PDF in Java

Hi, I am importing annotations and merging with pdf by following this documentation

But every time I merge the annotations to the document, seems like the new annotations are copied with the old one. That is, if pdf has annotations (say xfdf1) when I merge new annotations (say xfdf2) then the annotations shown is (newXfdf = xfdf1+xfdf2) thus repeating previous annotations and comments twice.
Is there an API to overwrite the annotations all together instead of merging?
or a way to only merge the delta value (i.e. xfdf2 - xfdf1)?


Hello, Iā€™m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Answering my own question - doc.fdfUpdate(fdf_doc); solved the problem.