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

Free Support Forum - aspose.com

PDF XFA FORM import/Export script error

Hi Team,
We are evaluating the ASPOSE sample code for PDF XFA Form import and export options. But we are facing as issue as in mentio screenshot.
As we are analysing the tool for one of our major requirement, it will be helpful if we get a quick support on this issue to understand the feasibility of this tool.

Sample template is attaching here for the analysis from ASPOSE team side.


  1. We want to fill this form controls with the values from database and save the form in a location. This generated form should have same signature as in the original file and all the events embedded in original file should be replicated.
  2. These forms have a validate button to ensure the correctness of the filled data and generate a barcode if all the filled data are valid and proper.

Issue in evaluation code downloaded from website.
• Signature not proper and script error also coming, bcoz of script error validate button and other events not working. Screenshot available in document

Sample code used for the testing

XFA PDF Import into XML-> Modify XML node text to bind values-> Import XML into PDF and generate new pdf. Screenshot available in document

XFA FORM Generation.docx (653.7 KB)

imm1294e-original.pdf (583.5 KB)


Can you please share the used xfdf file so that we may try to reproduce the same on our end.

InputFiles.zip (1.2 MB)

Input PDF and XFDF file also attached here.

Same i had XML also. These XFDF/ XML files i generated using the ASPOSE Export option only and same i am trying to import and create new pdf file.


I am getting XmlException with latest version of the API. We will check it further and share our feedback. However, please try to save the document incrementally by calling the Save method as under, and then share your feedback.


Hi Team,
I was using the same sample code given by aspose using the below line of code.
form.Save(dataDir + “imm1294 (Study Permit)- Edited (002)-xfdf_out-GENERATED.pdf”);

I am not getting how i can call .Save method multiple times for incremental changes. Please share sample code to understand the same.

Do you have any update on the XMLexception mentioned last time?


We are looking into the exception. You can call the Save method without passing any parameters, neither the file name or path. It will update the source PDF file without creating an additional file. I suggest you to please visit Document.Save Method for your convenience and share your feedback.


Sorry, I am unable to fix it. Please share the code snippet to make correction in my end check. Thanks!.


I request you to try this code and share your feedback.

Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form();
// Open Document
form.BindPdf(dataDir + "imm1294e-original.pdf");

// Open xfdf file.
System.IO.FileStream xfdfInputStream = new FileStream(dataDir + "imm1294 (Study Permit)- Edited (002).xfdf", FileMode.Open);

// Import data

// Close file stream

// Save updated document

I have checked the same code you posted, unfortunately the same is throwing an exception for me. Attached the screenshot for your reference. aspose-error-1.JPG (44.4 KB)

I have checked the similar code for XML also, it executed without error but the pdf file not getting any expected changes. Please help with a proper solution.


There is some confusion with your scenario. I can not reproduce the issue as explained in your Docx file while using the same code shared by you. Please elaborate how you are creating the PDF file which is having signature and script error. I request you to paste the code here instead of the snapshot.

We are looking for a method to integrate in our .net project for PDF form filling.
PDF form originally created in Adobe livecycle designed and internally xfa fields are using and additionally signature and owner password protected also.

  1. We want to fill this form controls with the values from database and save the form in a location. This generated form should have same signature as in the original file and all the events embedded in original file should be replicated.
  2. This form will be a Dynamic XFA form with multiple script events invoked based on user inputs. Generated form should have the same script features available.
  3. This form will be secured with an owner password protection.
    Sample form attached here for reference. Please let us know the requirements can be achieved with the aspose tool. If yes please share the sample code for achieving the same.

imm1294e-DisabledControl.pdf (678.3 KB)


I request you to share the owner password or a file without owner password for our testing.

Team- As this document is a publicly downloadable document from immigration authorities and owner is respective country immigration department, we don’t have the password. If we open the pdf manually , it will not be prompting for the password but the security level is elevated with owner password option. We are looking for the option to bypass the password option and fill the xfa fields. Thanks!


A ticket with ID PDFNET-50648 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.

Hi Team- any further update on this query?


Please note that it was recently logged in free support model and will be investigated and resolved on a first come first serve basis. We will surely inform you as soon as we make some definite progress towards its resolution. Please be patient and spare us some time.