I'm trying to convert a dynamic PDF document with an XFA form and Javascript into a standard PDF document that can be used to merge with other documents. I have had no luck up to this point. I've tried with the following code:
com.aspose.pdf.Document xfaDoc = new com.aspose.pdf.Document("path/to/xfa-pdf.pdf");
xfaDoc.getForm().flatten();
xfaDoc.getForm().setType(FormType.Standard);
xfaDoc.save("path/to/new-file.pdf");
When I try merging another PDF with new-file.pdf, the final PDF contains a blank page which represents the new-file.pdf followed by the pages of the other PDF. Any ideas?