I am getting a NullPointerException when trying to convert a dynamic XFA to an Acroform using Aspose.PDF 18.6 for Java. I am on Windows 10 and using IntelliJ IDEA 2018.1.5 as an IDE.
Here is my code:
public void convertXFAToAcroform(String inputFile, String outputFile) throws FileNotFoundException {
File file = new File(inputFile);
InputStream inputStream = new DataInputStream(new FileInputStream(file));
Document document = new Document(inputStream);
Form form = document.getForm();
form.setType(FormType.Standard);
document.save(outputFile);
}
Here is the error:
java.lang.NullPointerException
at com.aspose.pdf.Form.lif(Unknown Source)
at com.aspose.pdf.Form.setType(Unknown Source)
...
The error occurs on the line form.setType(FormType.Standard);
Here is the file I am using:
DynamicXFA.pdf (18.5 KB)
Let me know if I need to provide any more information.
Thank you!