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

import aspose.pdf as ap

# Step 1. Open document
pdf_document = ap.Document(data_dir + "FillFormField.pdf")

# Step 2. Get a field
text_box_field = pdf_document.form["textbox1"]

# Step 3. Modify field value
text_box_field.value = "Value to be filled in the field"
data_dir = data_dir + "FillFormField_out.pdf"

# Step 4. Save updated document
pdf_document.save(data_dir)