Fillable PDF Forms via Python

Сreate fillable PDF acroforms. Use Aspose.PDF for Python for .NET to modify PDF files programmatically

How to Fill PDF Forms Using Python for .NET Library

In order to fill PDF Forms (Acroforms) in a PDF file, we’ll use Aspose.PDF for .NET API, which is feature-rich, powerful, and easy-to-use document manipulation API for python-net platform. You can download its latest version directly from NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.

How to Fill AcroForm in PDF using Python


You need Aspose.PDF for .NET to try the code in your environment.

  1. Load PDF in an instance of Document class.
  2. Create a field in PDF file.
  3. Add field to the document.
  4. Save modified PDF

Fill AcroForm in PDF - Python

This sample code shows how to Fill PDF forms in PDF using Python

    // Step 1. Open document
    Document pdfDocument = new Document(dataDir + "FillFormField.pdf");

    // Step 2. Get a field
    TextBoxField textBoxField = pdfDocument.Form["textbox1"] as TextBoxField;

    // Step 3. Modify field value
    textBoxField.Value = "Value to be filled in the field";
    dataDir = dataDir + "FillFormField_out.pdf";

    // Step 4. Save updated document
    pdfDocument.Save(dataDir);