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

Free Support Forum - aspose.com

Java XFA Merge and Resulting PDF Not Loading

I am trying to merge a XFA document with XML in the code show below. However, after I do the save of the document and try to open it, I get the following message:


Please wait… If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be able to display this type of document.

How can I save the document so that it is saved as a normal non-XFA based document using the Java API. I have seen examples with then .NET API but not the Java API.

CODE:
<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Form form = new Form();
form.bindPdf(BASE_PATH + XFAPDF);
FileInputStream xmlInputStream = null;
try {
xmlInputStream = new FileInputStream(BASE_PATH + XML);
form.importXml(xmlInputStream);
xmlInputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
form.flattenAllFields();

form.save(BASE_PATH + FLATTENED_PDF);
form.dispose();<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>

Hi,


Thank you for contacting support. We have tested your code with the latest version 17.4 of Aspose.Pdf for Java API and unable to find any such message when using one of our sample XFA PDF and XML files. Please send us your source files for testing purposes and also list down the steps to replicate this message in our environment. Please note, we auto port Aspose.Pdf for .NET to Java to give developers perfectly the same features on both platforms. You can share .NET code examples and we will send you its alternative Java code.

Hi, I will private message you the files I am using. Specifically, I am getting that error when I try to open the flattened PDF in the latest version of LibreOffice, Microsoft Edge browser, and Chrome browser. It opens OK in the latest version of Adobe Reader.


Could you post the sample files you are using as well so I can try them out?

Thanks.

Hi,


Thank you for the details. We managed to replicate the said problem in our environment. It has been logged under the ticket ID PDFJAVA-36759 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. We are sorry for the inconvenience caused.
bhatsid:
Could you post the sample files you are using as well so I can try them out?
The output PDF has the same problem as you narrated. We will let you know once this problem is fixed.

Thank you. Do you happen to have an estimate for when this might be complete? We were hoping this Aspose product would be the solution for what we’re working on. We think with this fix it can be, but we would need to purchase sooner rather than later.

Hi,

Thank you for the inquiry. The linked ticket ID PDFJAVA-36759 has just been identified and it will take some time for our product team to further investigate the issue and provide a fix. We have logged an ETA request and will let you know once a significant progress has been made in this regard.