Working with XFA Forms

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 are set as 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 an XFA Acro Form.

MergeDocument document = new MergeDocument(pdfFilePath);
// Set the field values
document.Form.Fields["topmostSubform[0].Page1[0].TextBox1[0]"].Value = "My Text";  
document.Form.Fields["topmostSubform[0].Page1[0].ComboBox1[0]"].Value = "Item4";   
document.Form.Fields["topmostSubform[0].Page1[0].CheckBox1[0]"].Value = "Yes";
document.Form.Fields["topmostSubform[0].Page1[0].RadioButton1[0]"].Value = "Item2"; 
// Save the PDF         
Dim MyDocument As MergeDocument = New MergeDocument(pdfFilePath)
' Set the field values
MyDocument.Form.Fields("topmostSubform[0].Page1[0].TextBox1[0]").Value = "My Text"  
MyDocument.Form.Fields("topmostSubform[0].Page1[0].ComboBox1[0]").Value = "Item4"   
MyDocument.Form.Fields("topmostSubform[0].Page1[0].CheckBox1[0]").Value = "Yes"
MyDocument.Form.Fields("topmostSubform[0].Page1[0].RadioButton1[0]").Value = "Item2"
' Save the PDF         

In this topic