ceTe Software Help Library for Java September - 2021
DynamicPDF Merger for Java / Programming with Merger for Java / Merger WorkingwithXFAForms
Merger WorkingwithXFAForms

XFA Form Filling

Merger supports the filling of static XFA forms as long as those XFA forms contain a fields entry. XFA Form field values can be set as they are merged into a new PDF document. This is done through the Form property of the MergeDocument class. The value that is specified needs to match the export value for the form field. Unicode values are fully supported.

This example shows how to set the values on a XFA Acro Form:

[Java]
MergeDocument document = new MergeDocument("C:\\Document.pdf");
// Set the field values
document.getForm().getFields().getFormField("topmostSubform[0].Page1[0].TextBox1[0]").setValue("My Text");  
document.getForm().getFields().getFormField("topmostSubform[0].Page1[0].ComboBox1[0]").setValue("Item4");   
document.getForm().getFields().getFormField("topmostSubform[0].Page1[0].CheckBox1[0]").setValue("Yes");
document.getForm().getFields().getFormField("topmostSubform[0].Page1[0].RadioButton1[0]").setValue("Item2"); 
// Save the PDF         
document.draw("C:\\MyDocument.pdf");