IRONSOFTWAREHOME
PDF Forms
from ironpdf import *

# Step 1.  Creating a PDF with editable forms from HTML using form and input tags
# Radio Button and Checkbox can also be implemented with input type 'radio' and 'checkbox'
form_html = """
    <html>
        <body>
            <h2>Editable PDF  Form</h2>
            <form>
              First name: <br> <input type='text' name='firstname' value=''> <br>
              Last name: <br> <input type='text' name='lastname' value=''> <br>
              <br>
              <p>Please specify your gender:</p>
              <input type='radio' id='female' name='gender' value= 'Female'>
                <label for='female'>Female</label> <br>
                <br>
              <input type='radio' id='male' name='gender' value='Male'>
                <label for='male'>Male</label> <br>
                <br>
              <input type='radio' id='non-binary/other' name='gender' value='Non-Binary / Other'>
                <label for='non-binary/other'>Non-Binary / Other</label>
              <br>
 
              <p>Please select all medical conditions that apply:</p>
              <input type='checkbox' id='condition1' name='Hypertension' value='Hypertension'>
              <label for='condition1'> Hypertension</label><br>
              <input type='checkbox' id='condition2' name='Heart Disease' value='Heart Disease'>
              <label for='condition2'> Heart Disease</label><br>
              <input type='checkbox' id='condition3' name='Stoke' value='Stoke'>
              <label for='condition3'> Stoke</label><br>
              <input type='checkbox' id='condition4' name='Diabetes' value='Diabetes'>
              <label for='condition4'> Diabetes</label><br>
              <input type='checkbox' id='condition5' name='Kidney Disease' value='Kidney Disease'>
              <label for='condition5'> Kidney Disease</label><br>
            </form>
        </body>
    </html>"""

# Instantiate Renderer
renderer = ChromePdfRenderer()
renderer.RenderingOptions.CreatePdfFormsFromHtml = True
renderer.RenderHtmlAsPdf(form_html).SaveAs("BasicForm.pdf")

# Step 2. Reading and Writing PDF form values.
form_document = PdfDocument.FromFile("BasicForm.pdf")

# Set and Read the value of the "firstname" field
first_name_field = form_document.Form.FindFormField("firstname")
first_name_field.Value = "Minnie"
print("FirstNameField value: {}".format(first_name_field.Value))

# Set and Read the value of the "lastname" field
last_name_field = form_document.Form.FindFormField("lastname")
last_name_field.Value = "Mouse"
print("LastNameField value: {}".format(last_name_field.Value))

form_document.SaveAs("FilledForm.pdf")
pip install ironpdf
PDF Forms

PDF Forms

IronPDF for Python can both create interactive PDF forms from HTML and read or write the field values of existing PDF forms programmatically.

Getting Started

Enable form creation by setting RenderingOptions.CreatePdfFormsFromHtml = True before rendering HTML that contains <input>, <select>, or <textarea> elements. To read or write field values in an existing form, load the PDF and use Form.FindFormField.

Understanding the Code

Creating Forms

  • CreatePdfFormsFromHtml = True: Converts HTML form elements (<input>, <radio>, <checkbox>, etc.) into interactive PDF form fields when rendering.
  • RenderHtmlAsPdf(form_html): Renders the HTML form as a PDF with interactive, fillable fields. SaveAs("BasicForm.pdf") writes it to disk.

Reading and Writing Field Values

  • PdfDocument.FromFile("BasicForm.pdf"): Loads the saved form PDF for field manipulation.
  • form_document.Form.FindFormField(name): Returns a form field object for the field with the given name attribute value from the original HTML.
  • field.Value = "text": Sets the value of the form field programmatically.
  • field.Value: Reads the current value of the form field.
  • SaveAs("FilledForm.pdf"): Saves the PDF with all field values populated.

Supported Form Field Types

IronPDF supports text inputs, radio buttons, checkboxes, dropdowns (<select>), and text areas. All are created automatically from the corresponding HTML elements when CreatePdfFormsFromHtml is enabled.

Learn to create and fill PDF forms with IronPDF for Python!

Ready to Get Started?

Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
Python Module Download for PDF
Install with pip

Version: 2026.9

  1. Download and install Python 3.7+.
  2. Install pip from pypi.org if it isn't installed already.
  3. Execute the above command in the terminal.
Python PDF Module
Download Module

Version: 2026.9

Manually install into your project

  1. Download the package
  2. Run this command from the terminal
    pip install ironpdf-2026.9-py37-none-win_amd64.whi

Licenses from $999