PdfFormField Class | PdfDocument Class | Working With Acro Forms | MergeOptions Class | Programming with Merger for Java

Welcome > Merger > Programming > Working With Acro Forms > Reading Form Field Values

The values of Acro Form fields can be read from an existing PDF document using the getForm() property of the PdfDocument class.

This example shows how to read the value of Acro Form fields from an existing PDF document:

[Java]
    // Create a PdfDocument object
    PdfDocument pdfDocument = new PdfDocument("[PhysicalPath]/DocumentA.pdf");
    // Set the Acro Form field values to local variables
    String textBox1Value = pdfDocument.getForm().getFields().getPdfFormField("TextBox1").getValue();
    String checkBox1Value = pdfDocument.getForm().getFields().getPdfFormField("CheckBox1").getValue();
    String comboBox1Value = pdfDocument.getForm().getFields().getPdfFormField("ComboBox1").getValue();
    String radioButton1Value = pdfDocument.getForm().getFields().getPdfFormField("RadioButton1").getValue();
    String listBox1Value = pdfDocument.getForm().getFields().getPdfFormField("ListBox1").getValue();

See Also 

PdfFormField Class | PdfDocument Class | Working With Acro Forms | MergeOptions Class | Programming with Merger for Java