ceTe Software Help Library for Java August - 2020
DynamicPDF Merger for Java / Programming with Merger for Java / Working With AcroForms / Reading Form Field Values
In This Topic
    Reading Form Field Values
    In This Topic

    The values of Acro Form fields can be read from an existing PDF document using the getForm() property of the MergeDocument class. In addition to being to read out the actual text values of the Form Fields, formatting of that Form Field (including font, font size, font color, background color, border color and border style) can also be retrieved.

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

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