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

Free Support Forum - aspose.com

Form.importXml broken in 21 (worked correctly in version 19.2)

Hello support,

since upgrading the Java version of Aspose-Pdf from 19.2 to 21.5 (and today while testing this bug also to the latest 21.10!) we experience a bug with the importForm functionality of the facades.Form class.

Example source code:

// Aspose initialization...

InputStream pdfFormInputStream = getClass().getResourceAsStream("AIA_14_201802_20201130.pdf");
InputStream xmlInputStream = getClass().getResourceAsStream("Filled_SB14_data.xml");
FileOutputStream outputStream = new FileOutputStream("Result_SB14.pdf");

Document document = new Document(pdfFormInputStream);
Form form = new Form(document);
form.importXml(xmlInputStream);
document.saveIncrementally(outputStream);

Always the first form element of some specific kind (couldn’t figure out the pattern) is not correctly filled!
So while the XML data is available for e.g. address1 or postcode of every element, it stays empty for the first set (the person “Acker, Tami”).
It is correctly filled for “Dankenschweil, Beverly” and “Barth, Jost”. (We tested switching the data round - it will always fail for the first set.)

As we use this functionality since years for vital business functionality of our customers, a quick fix (or advice, how to adopt the PDF or XML to prevent the issue) would be really important and extremely helpful for us!

Thanks a lot,
Stefan

The ZIP with the two inputs (pdf template and xml):
Form.importXML.bug.zip (1.2 MB)

The screenshot of the broken result, marking all the fields where data is not correctly imported (mind that some fields like the name are correctly filled!):
Form.importXml.result.png (51.8 KB)

@stefan.raubal

A ticket with ID PDFJAVA-40990 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Thank you @mudassir.fayyaz,

so I suppose there is no work around that you can offer right now?

Kind regards,
Stefan

@stefan.raubal

Yes, we will be able to suggest any workaround after investigating this issue.

Hello @mudassir.fayyaz,

do you have any news about PDFJAVA-40990? Is it already scheduled?
We are stuck with this business case because we don’t see any work around… :frowning:

Kind regards,
Stefan

@stefan.raubal

Currently, your issue is pending for analysis and is in the queue. Once we complete the analysis of your issue, we will then be able to provide you an estimate.