ImportXml does not import nodes with xfdf attributes

Hi,


We have an existing feature that we have developed since a while with Aspose.Pdf.Kit to import xml data in a PDF (we already know how to migrate this piece of code to Aspose.Pdf.Facade so that’s not the aim of this post)

Our problem:
  1. Using Acrobat Reader, we fill in all the fields available in the aia0008.pdf attached file
  2. We export data into XML format (see attached AIA8.xml file)
  3. If we import it back using Acrobat Reader, no problem, all the nodes are correctly read and displayed back in the PDF
  4. Now we proceed with the same using Aspose.Pdf.Facade.Form.ImportXml
Result: the fields with an xfdf attribute are not imported (example: ApplicationNumber in the xml)

Any idea?

Thanks,
Jerome

Hi Jerome,

Thank you for sharing the details and sample files.

Well, as you need to import the XFDF file to your PDF document, you will need to use ImportXfdf method of Aspose.Pdf.Facades.Form class. Also, your file should be in proper format to be imported. For that, you may check the following documentation link regarding details of different import formats.

Whats the Difference Between XML, FDF and XFDF

Import Data from XFDF into a PDF File (Facades)

Following is the sample code and attached is a sample XFDF file(based on your XML file) which works fine with Aspose.Pdf for .NET. Please try it and let us know in case you still face any problem.

Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form();

FileStream fs = new FileStream("aia0008.pdf",

FileMode.Open,

FileAccess.ReadWrite);

form.BindPdf(fs);

FileStream xmlInputStream = new FileStream("AIA8.xfdf", FileMode.Open);

form.ImportXfdf(xmlInputStream);

xmlInputStream.Close();

form.Save(fs);

fs.Close();

In case you still face any issue, please do let us know.

Sorry for the inconvenience,

Update: using your “What is the difference Between XML, FDF and XFDF” article, I used the XML format which is very close to the XFDF format, and it worked!


Thanks,
Jerome

Hi Jerome,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the confirmation.

We are pleased to know that your issue got resolved. Please feel free to contact support in case you need any further assistance.

Thank You & Best Regards,