Import Xml to Dynamic pdf flattens fields automatically

I have a dynamic PDF that has to be filled with xml data. I am using the following code to fill the pdf using java:
com.aspose.pdf.facades.Form form = new com.aspose.pdf.facades.Form();
form.bindPdf(“c:/pdf/template.pdf”);
java.io.FileInputStream xmlInputStream = new FileInputStream(“c:/pdf/sample_xml.xml”);
form.importXml(xmlInputStream);
xmlInputStream.close();
form.save(“c:/pdf/FilledPDFFile.pdf”);
form.dispose();

By doing so, the data is getting populated correctly but all the fields are getting flattened automatically and the pdf is no more interactive. I want to retain the pdf as interactive form with data filled in. In itext I was able to achieve this using append mode in pdf doc. Is there something similar in aspose?

Also, I have one more query. The interactive pdf has a button which can be clicked to attach csv documents. Is there a way to trigger the button action and attach the csv doc through aspose library? Please help me on this. TIA.

@srisankar

In case you are using old version of Aspose.PDF for Java, we suggest you please upgrade to the latest version of Aspose.PDF for Java 22.4. Hope this helps you.

If you still face problem, please ZIP and attach your input XML and PDF along with problematic and expected output PDF files here for testing. We will investigate the issue and provide you more information on it.