How to Fill and Edit PDF Forms

by Chaknith

IronPDF offers an intuitive toolset to edit existing forms in a PDF document, including text areas, text inputs, checkboxes, combo boxes, and radio buttons.

C# NuGet Library for PDF

Install with NuGet

Install-Package IronPdf
or
Java PDF JAR

Download DLL

Download DLL

Manually install into your project

C# NuGet Library for PDF

Install with NuGet

Install-Package IronPdf
or
Java PDF JAR

Download DLL

Download DLL

Manually install into your project

Start using IronPDF in your project today with a free trial.

First Step:
green arrow pointer

Check out IronPDF on Nuget for quick installation and deployment. With over 8 million downloads, it's transforming PDF with C#.

C# NuGet Library for PDF nuget.org/packages/IronPdf/
Install-Package IronPdf

Consider installing the IronPDF DLL directly. Download and manually install it for your project or GAC form: IronPdf.zip

Manually install into your project

Download DLL

Edit Forms

IronPDF effortlessly edits existing form fields of various types in a PDF document.

Text Area and Input Forms

To edit text areas and input forms, assign the Value property to the desired information. The code below first finds the form object using the FindFormField method with the form name. Then, it accesses and assigns the Value property of the object.

:path=/static-assets/pdf/content-code-examples/how-to/edit-forms-input-textarea.cs
using IronPdf;

PdfDocument pdf = PdfDocument.FromFile("textAreaAndInputForm.pdf");

// Set text input form values
pdf.Form.FindFormField("firstname").Value = "John";
pdf.Form.FindFormField("lastname").Value = "Smith";

// Set text area form values
pdf.Form.FindFormField("address").Value = "Iron Software LLC\r\n205 N. Michigan Ave.";

pdf.SaveAs("textAreaAndInputFormEdited.pdf");
Imports Microsoft.VisualBasic
Imports IronPdf

Private pdf As PdfDocument = PdfDocument.FromFile("textAreaAndInputForm.pdf")

' Set text input form values
pdf.Form.FindFormField("firstname").Value = "John"
pdf.Form.FindFormField("lastname").Value = "Smith"

' Set text area form values
pdf.Form.FindFormField("address").Value = "Iron Software LLC" & vbCrLf & "205 N. Michigan Ave."

pdf.SaveAs("textAreaAndInputFormEdited.pdf")
VB   C#

Output PDF document


Checkbox and Combobox Forms

Edit existing checkbox and combobox forms by first finding the form field by its name. Assign the Value property to 'Yes' to check the checkbox form. Select any available choice in the combobox by assigning the desired choice to its Value property. For convenience, retrieve all the choices' values by accessing the Choices property.

:path=/static-assets/pdf/content-code-examples/how-to/edit-forms-checkbox-combobox.cs
using IronPdf;
using System;

PdfDocument pdf = PdfDocument.FromFile("checkboxAndComboboxForm.pdf");

var checkboxForm = pdf.Form.FindFormField("taskCompleted");
// Check the checkbox form
checkboxForm.Value = "Yes";

var comboboxForm = pdf.Form.FindFormField("priority");
// Set the combobox value
comboboxForm.Value = "Low";

// Print out all the available choices
foreach (var choice in comboboxForm.Choices)
{
    Console.WriteLine(choice);
}
pdf.SaveAs("checkboxAndComboboxFormEdited.pdf");
Imports IronPdf
Imports System

Private pdf As PdfDocument = PdfDocument.FromFile("checkboxAndComboboxForm.pdf")

Private checkboxForm = pdf.Form.FindFormField("taskCompleted")
' Check the checkbox form
checkboxForm.Value = "Yes"

Dim comboboxForm = pdf.Form.FindFormField("priority")
' Set the combobox value
comboboxForm.Value = "Low"

' Print out all the available choices
For Each choice In comboboxForm.Choices
	Console.WriteLine(choice)
Next choice
pdf.SaveAs("checkboxAndComboboxFormEdited.pdf")
VB   C#

Output PDF document


Radio buttons Forms

When working with radio button forms in IronPDF, radio buttons of the same group are contained within one form object. To edit the radio button value, simply assign the Value property of the form object to one of the available choices. Retrieve all the available choices with the Annotations property. The code below demonstrates how to edit the radio button value.

:path=/static-assets/pdf/content-code-examples/how-to/edit-forms-radiobutton.cs
using IronPdf;
using System;

PdfDocument pdf = PdfDocument.FromFile("radioButtomForm.pdf");
var radioForm = pdf.Form.FindFormField("traveltype");

// Set the radio button value
radioForm.Value = "Airplane";

// Print out all the available choices
foreach(var annotation in radioForm.Annotations)
{
    Console.WriteLine(annotation.OnAppearance);
}

pdf.SaveAs("radioButtomFormEdited.pdf");
Imports IronPdf
Imports System

Private pdf As PdfDocument = PdfDocument.FromFile("radioButtomForm.pdf")
Private radioForm = pdf.Form.FindFormField("traveltype")

' Set the radio button value
radioForm.Value = "Airplane"

' Print out all the available choices
For Each annotation In radioForm.Annotations
	Console.WriteLine(annotation.OnAppearance)
Next annotation

pdf.SaveAs("radioButtomFormEdited.pdf")
VB   C#

Additionally, use the Clear method to deselect the radio button. This method can only be accessed when the object is of type RadioFormField. Upon accessing the radio form object from the PDF, it can be casted to the RadioFormField type.

Output PDF document

Learn how to create PDF forms programmatically in the following article: "How to Create PDF Forms."

Chaknith Bin

Software Engineer

Chaknith is the Sherlock Holmes of developers. It first occurred to him he might have a future in software engineering, when he was doing code challenges for fun. His focus is on IronXL and IronBarcode, but he takes pride in helping customers with every product. Chaknith leverages his knowledge from talking directly with customers, to help further improve the products themselves. His anecdotal feedback goes beyond Jira tickets and supports product development, documentation and marketing, to improve customer’s overall experience.When he isn’t in the office, he can be found learning about machine learning, coding and hiking.