'XML Parsing error' exception thrown on CreateFromXFDF when pdf has form with any value entered

125 views
Skip to first unread message

Morne Scholtz

unread,
Jul 25, 2014, 5:42:27 AM7/25/14
to pdfne...@googlegroups.com
Hi there,

I am saving annotations separately in an XFDF file. Each time a PDF is opened I extract the FDF from the XFDF file and merge it with FDFMerge.

Below is my method for opening or creating the XFDF:

-(void)openAnnotations:(NSString*)fullPath {
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath])
{
[_pdfDoc InitSecurityHandler];
FDFDoc *fdfDoc = [FDFDoc CreateFromXFDF:fullPath];
{
// merge in the annotations
[_pdfDoc FDFMerge:fdfDoc];
}
}else{
[_pdfDoc InitSecurityHandler];
FDFDoc *fdfDoc = [_pdfDoc FDFExtract: e_annots_only];
{
[fdfDoc SaveAsXFDF:_annotationFilePath];
}
}
}

This is my method to save the annotations:

-(BOOL)saveAnnotations {
if (!_readOnly){
FDFDoc *doc_annots = [_pdfDoc FDFExtract: e_annots_only];
[doc_annots SaveAsXFDF:_annotationFilePath];
return YES;
} else {
return NO;
}

}

The problem I am experiencing is that when I open a PDF with form fields, that has any single/multiple values already populated (with <value>********</value> in the XFDF, when I try to CreateFromXFDF to merge it back into the PDF for display, I get an exception:

*** Terminating app due to uncaught exception 'PDFNet Exception', reason: 'XML Parsing error'

I have tried e_both, and still get the same exception.

I am not really interested in the form fields or values, and only really care about annotations.

Thank you!
Morne

Aaron

unread,
Jul 25, 2014, 4:28:59 PM7/25/14
to pdfne...@googlegroups.com
Hello Morne,

Based on the error it sound like the error is with with the PDF and/or the XFDF file.  Could you forward both to sup...@pdftron.com so that we could take a closer look?  Thank you for your help.
Reply all
Reply to author
Forward
0 new messages