Fill AcroForm - Fill PDF Form using Python

Fill Form Field in a PDF Document

To fill a form field, get the field from the Document object’s Form collection. then set the field value using the field’s value property.

This example selects a TextBoxField and sets its value using the Value property.


    import aspose.pdf as ap

    # Open document
    pdfDocument = ap.Document(input_file)
    for formField in pdfDocument.form.fields:
        if formField.partial_name == "Field 1":
            # Modify field value
            formField.value = "777"

    # Save updated document
    pdfDocument.save(output_pdf)