Extract XFA Form

Get Value from an Form 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.


    // Load XFA form
    $document = new Document($inputFile);
    
    // Get names of XFA form fields
    $names = $document->getForm()->getXFA()->getFieldNames();
        
    // Get field values
    $document->getForm()->getXFA()->get_Item($names[0]);
    $document->getForm()->getXFA()->get_Item($names[1]);
    
    // Save modified PDF    
    $document->close();