Extract Data AcroForms

Get Value from an Individual Field of PDF Document

The form field’s getValue() method allows you to get the value of a particular field.

To get the value, get the form field from the Document object’s Form collection.

This example selects a textBoxField and retrieves its value using the getValue() method.


    // Open a document
    $document = new Document($inputFile);

    // Get a field
    $textBoxField = $document->getForm()->get("textbox1");

    // Get the field name
    $responseData = "PartialName: " . $textBoxField->getPartialName();

    // Get the field value
    $responseData = $responseData . " Value: " . $textBoxField->getValue();
    $document->close();