How to Fill and Edit PDF Forms
IronPDF offers an intuitive toolset to edit existing forms in a PDF document, including text areas, text inputs, checkboxes, combo boxes, and radio buttons.
Get started with IronPDF
Start using IronPDF in your project today with a free trial.
How to Fill and Edit PDF Forms
- Download a C# library for filling and editing PDF forms
- Import the targeted PDF document using the
FromFile
method - Find the form object to modify using the
FindFormField
method - Modify the Value property to set the desired information
- Export the edited PDF document
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")
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")
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")
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 cast to the RadioFormField type.
Output PDF document
Remove Forms
To remove forms from the PDF, first select the target form using the FindFormField
method. Pass the form object to the Form.Remove
method, which can be accessed from the PdfDocument object.
:path=/static-assets/pdf/content-code-examples/how-to/edit-forms-remove-form.cs
using IronPdf;
using IronSoftware.Forms;
PdfDocument pdf = PdfDocument.FromFile("textAreaAndInputForm.pdf");
// Remove Form
IFormField targetForm = pdf.Form.FindFormField("firstname");
pdf.Form.Remove(targetForm);
pdf.SaveAs("removedForm.pdf");
Imports IronPdf
Imports IronSoftware.Forms
Private pdf As PdfDocument = PdfDocument.FromFile("textAreaAndInputForm.pdf")
' Remove Form
Private targetForm As IFormField = pdf.Form.FindFormField("firstname")
pdf.Form.Remove(targetForm)
pdf.SaveAs("removedForm.pdf")
Output PDF document
Learn how to create PDF forms programmatically in the following article: "How to Create PDF Forms."
Ready to see what else you can do? Check out our tutorial page here: Sign and Secure PDFs
Frequently Asked Questions
How can I start editing PDF forms using a C# library?
To start editing PDF forms using IronPDF, first download the C# library from NuGet. Then, import the PDF document using the FromFile method, locate the form field using FindFormField, and modify the Value property as needed.
How do I edit text areas and input forms in a PDF using a C# library?
To edit text areas and input forms, use the FindFormField method to locate the form field by name. Then, assign the desired value to the Value property of the form field object in IronPDF.
How can I edit checkboxes and comboboxes in a PDF form with a C# library?
To edit checkboxes, set the Value property to 'Yes'. For comboboxes, assign the desired choice to the Value property after finding the field with FindFormField. You can access all choice values using the Choices property in IronPDF.
What is the method to edit radio button forms using a C# library?
Radio buttons are edited by assigning the desired choice to the Value property of the form object in IronPDF. Access all available choices using the Annotations property, and use the Clear method to deselect a radio button.
How can I remove forms from a PDF using a C# library?
To remove a form from a PDF, use the FindFormField method to select the form field, then pass the field object to the Form.Remove method from the PdfDocument object in IronPDF.
Can a C# library be used to edit existing PDF form fields of any type?
Yes, IronPDF can edit existing form fields such as text areas, text inputs, checkboxes, comboboxes, and radio buttons in a PDF document.
Is it possible to programmatically create PDF forms using a C# library?
Yes, you can programmatically create PDF forms using IronPDF. For more information, refer to the article '[How to Create PDF Forms](/how-to/create-forms/)'.
What additional features does a document management solution provide?
IronSecureDoc offers solutions for managing SaaS services like digital signing, redaction, encryption, and protection, all with a one-time payment.