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
C# PDF DLL

Download DLL

Download DLL

Manually install into your project

Edit Forms

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

Text Area and Input Forms

To edit text area and input forms, assign the Value property to the desired information. The code below first finds the form object using the FindFormField method by inputting the form name. Then, assess and assign 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 with its name. Check the checkbox form by assigning the Value property to 'Yes'. Select any available choices 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. This method can only be acessed when the retrieve radio object being cast to RadioFormField type.

Output PDF document

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.