Extract AcroForm - Extract Form Data from PDF in Python

Extract data from form

Get Values from all the Fields of PDF Document

To get values from all the fields in a PDF document, you need to navigate through all the form fields and then get the value using the Value property. Get each field from the Form collection, in the base field type called Field and access its value property.

The following Python code snippets show how to get the values of all the fields from a PDF document.


    import aspose.pdf as ap

    # Open document
    pdfDocument = ap.Document(input_file)

    # Get values from all fields
    for formField in pdfDocument.form.fields:
        # Analyze names and values if need
        print("Field Name : " + formField.partial_name)
        print("Value : " + str(formField.value))