XFDF file we generated doesn't get merged into PDFDoc

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' ?> `

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.