XFDF file we generated doesn't get merged into PDFDoc.

22 views
Skip to first unread message

Ryan

unread,
Jul 11, 2016, 5:06:37 PM7/11/16
to PDFTron PDFNet SDK
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.
Reply all
Reply to author
Forward
0 new messages