Question:
We are generating our own XFDF file, and it is failing on the following line
var fdoc = FDFDoc.CreateFromXFDF (AnnotationXml);
if (myviewer.Doc != null)
{
LockDocument();
myviewer.Doc.FDFMerge(fdoc); // exception thrown
Here is the XFDF
<?xml version='1.0' encoding='UTF-8' ?>
<xfdf xmlns='http://ns.adobe.com/xfdf/' xml:space='preserve'>
<fields />
<annots>
<highlight name='name' page='-2147483648' title='title' subject='subject' rect='144.837204,208.190317,524.711359,726.986871' color='#FFFF00' opacity='1' coords='170.904781,208.190317,524.711359,708.554538,144.837204,226.622650,498.643783,726.986871' date="D:20160706184244+02'00'"><popup flags='print,nozoom,norotate' page='-2147483648' rect='144.837204,208.190317,524.711359,726.986871' open='no'/></highlight>
</annots>
<pages />
</xfdf>
Answer:
The pages are incorrect value. In XFDF files page numbers start at zero (first page). In FDF/PDF pages start at count at one. So to go from FDF/PDF to XFDF subtract one from the PDF page numbers.