We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

NullPointerException on calls to Form methods

I download the aspose.pdf.kit today. I want to export a pdf file to xml to study the internal structure. There are only two lines of code.

Form frm= new Form("input.pdf");

frm.exportXml("output.xml");

The second line throws a NullPointerException. I tried a number of valid pdf files as input. All give me the same error. I also tried calling other methods of Form and got the same error too.

Hi

Thanks for considering Aspose.

As far as I've noticed from your code, you are using Aspose.Pdf.Kit for Java. I am not sure why you are facing this problem, as I've tested the scenario and its working fine at my end. Please try using the following code snippet. In case you still face any problem, please share some resource Pdf files, so that we can test the issue at our end.

[Java]

// Assign an input PDF document whose contents are needed to export
Form frm= new Form("d:/pdftest/ChkBox_Issue.pdf");<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

// Export the values of all PDF form fields to the XML file
frm.exportXml("d:/pdftest/ChkBox_Issue.xml");

// Release the object
form.close();