How to Create PDF Forms in C#
Create interactive PDF forms in C# using IronPDF's comprehensive API that supports text inputs, checkboxes, radio buttons, comboboxes, image forms, and digital signatures with just a few lines of code.
Quickstart: Build Your First PDF Form with IronPDFGet started fast with IronPDF to create interactive, fillable PDF forms. This guide shows you how to dynamically generate a PDF with form fields using simple C# code. By leveraging IronPDF's robust API, you can create text inputs, checkboxes, and more to enhance user interaction with minimal effort. Follow along to see how easy it is to define form elements and save your document.
-
1Install IronPDF with NuGet Package Manager
-
2Copy and run this code snippet.
new IronPdf.ChromePdfRenderer { RenderingOptions = { CreatePdfFormsFromHtml = true } } .RenderHtmlAsPdf("<html><body><form>First name: <input type='text' name='firstname' value=''>Last name: <input type='text' name='lastname' value=''></form></body></html>") .SaveAs("editableForm.pdf");C# -
3Deploy to test on your live environment
Start using IronPDF in your project today with a free trial
Reduce yearly PDF security and compliance costs. IronSecureDoc provides digital signing, redaction, encryption, and protection solutions for a one-time payment. View IronSecureDoc Documentation
Minimal Workflow (5 steps)
- Download IronPDF C# Library
- Use input and textarea tags in HTML to generate forms
- Set type to "checkbox" and use select tag for checkboxes and comboboxes
- Change type to "radio" for radio buttons
- Check the generated PDF output
How Do I Create PDF Forms with IronPDF?
IronPDF creates PDF documents with embedded form fields of various types. By adding dynamic form elements to static PDF documents, you enhance flexibility and interactivity. The library supports all form elements needed for modern PDF applications, from simple text inputs to complex signature fields. Before creating forms, ensure you've installed IronPDF and configured your development environment.
How Can I Add Text Areas and Input Forms?
How Do I Render Forms From HTML?
Create text area and input forms to capture user input within PDF documents. Text areas provide space for larger text amounts, while input forms allow specific value entries. IronPDF's HTML to PDF conversion engine supports HTML form elements, simplifying complex form creation.
using IronPdf;
// Input and Text Area forms HTML
string FormHtml = @"
<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>
Address: <br> <textarea name='address' rows='4' cols='50'></textarea>
</form>
</body>
</html>
";
// Instantiate Renderer
ChromePdfRenderer Renderer = new ChromePdfRenderer();
Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
Renderer.RenderHtmlAsPdf(FormHtml).SaveAs("textAreaAndInputForm.pdf");Imports IronPdf
' Input and Text Area forms HTML
Private FormHtml As String = "
<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>
Address: <br> <textarea name='address' rows='4' cols='50'></textarea>
</form>
</body>
</html>
"
' Instantiate Renderer
Private Renderer As New ChromePdfRenderer()
Renderer.RenderingOptions.CreatePdfFormsFromHtml = True
Renderer.RenderHtmlAsPdf(FormHtml).SaveAs("textAreaAndInputForm.pdf")Output PDF Document
How Do I Add Text Forms Programmatically?
Add text form fields through code without HTML. First, instantiate a TextFormField object with required parameters. Then use the Add() method of the Form property to add the form. This approach works well when you need to edit existing PDFs or add forms to documents not created with HTML.
using IronPdf;
using IronSoftware.Forms;
// Instantiate ChromePdfRenderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>");
// Configure required parameters
string name = "firstname";
string value = "first name";
uint pageIndex = 0;
double x = 100;
double y = 700;
double width = 50;
double height = 15;
// Create text form field
var textForm = new TextFormField(name, value, pageIndex, x, y, width, height);
// Add form
pdf.Form.Add(textForm);
pdf.SaveAs("addTextForm.pdf");Imports IronPdf
Imports IronSoftware.Forms
' Instantiate ChromePdfRenderer
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>")
' Configure required parameters
Private name As String = "firstname"
Private value As String = "first name"
Private pageIndex As UInteger = 0
Private x As Double = 100
Private y As Double = 700
Private width As Double = 50
Private height As Double = 15
' Create text form field
Private textForm = New TextFormField(name, value, pageIndex, x, y, width, height)
' Add form
pdf.Form.Add(textForm)
pdf.SaveAs("addTextForm.pdf")Output PDF Document
Add labels to form fields by drawing text with the DrawText method. Learn more about How to Draw Text and Bitmap on PDFs. Explore custom fonts to enhance form appearance.
How Do I Create Checkbox and Combobox Forms?
How Do I Render Checkboxes and Comboboxes From HTML?
Create checkbox and combobox forms by rendering HTML strings, files, or web URLs containing these elements. Set the RenderingOptions.CreatePdfFormsFromHtml property to true to enable form creation from HTML. For complex scenarios, convert ASPX pages containing server-side form controls.
Combobox forms provide dropdown selections. Users choose from available options, providing input within PDF documents.
using IronPdf;
// Input and Text Area forms HTML
string FormHtml = @"
<html>
<body>
<h2>Editable PDF Form</h2>
<h2>Task Completed</h2>
<label>
<input type='checkbox' id='taskCompleted' name='taskCompleted'> Mark task as completed
</label>
<h2>Select Priority</h2>
<label for='priority'>Choose priority level:</label>
<select id='priority' name='priority'>
<option value='high'>High</option>
<option value='medium'>Medium</option>
<option value='low'>Low</option>
</select>
</body>
</html>
";
// Instantiate Renderer
ChromePdfRenderer Renderer = new ChromePdfRenderer();
Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
Renderer.RenderHtmlAsPdf(FormHtml).SaveAs("checkboxAndComboboxForm.pdf");Imports IronPdf
' Input and Text Area forms HTML
Private FormHtml As String = "
<html>
<body>
<h2>Editable PDF Form</h2>
<h2>Task Completed</h2>
<label>
<input type='checkbox' id='taskCompleted' name='taskCompleted'> Mark task as completed
</label>
<h2>Select Priority</h2>
<label for='priority'>Choose priority level:</label>
<select id='priority' name='priority'>
<option value='high'>High</option>
<option value='medium'>Medium</option>
<option value='low'>Low</option>
</select>
</body>
</html>
"
' Instantiate Renderer
Private Renderer As New ChromePdfRenderer()
Renderer.RenderingOptions.CreatePdfFormsFromHtml = True
Renderer.RenderHtmlAsPdf(FormHtml).SaveAs("checkboxAndComboboxForm.pdf")Output PDF Document
How Do I Add Checkboxes and Comboboxes Programmatically?
How Do I Create a Checkbox Form Field?
To add checkboxes, instantiate a CheckboxFormField object with required parameters. The value parameter determines check state: "no" for unchecked, "yes" for checked. Use the Add() method of the Form property to add the form.
using IronPdf;
using IronSoftware.Forms;
// Instantiate ChromePdfRenderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Checkbox Form Field</h2>");
// Configure required parameters
string name = "checkbox";
string value = "no";
uint pageIndex = 0;
double x = 100;
double y = 700;
double width = 15;
double height = 15;
// Create checkbox form field
var checkboxForm = new CheckboxFormField(name, value, pageIndex, x, y, width, height);
// Add form
pdf.Form.Add(checkboxForm);
pdf.SaveAs("addCheckboxForm.pdf");Imports IronPdf
Imports IronSoftware.Forms
' Instantiate ChromePdfRenderer
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h2>Checkbox Form Field</h2>")
' Configure required parameters
Private name As String = "checkbox"
Private value As String = "no"
Private pageIndex As UInteger = 0
Private x As Double = 100
Private y As Double = 700
Private width As Double = 15
Private height As Double = 15
' Create checkbox form field
Private checkboxForm = New CheckboxFormField(name, value, pageIndex, x, y, width, height)
' Add form
pdf.Form.Add(checkboxForm)
pdf.SaveAs("addCheckboxForm.pdf")Output PDF Document
How Do I Create a Combobox Form Field?
To add comboboxes, instantiate a ComboboxFormField object with required parameters. The value parameter determines the selected choice. Use the Add() method of the Form property to add the form. When working with form data, extract text and images from existing PDFs to populate comboboxes dynamically.
using IronPdf;
using IronSoftware.Forms;
using System.Collections.Generic;
// Instantiate ChromePdfRenderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Combobox Form Field</h2>");
// Configure required parameters
string name = "combobox";
string value = "Car";
uint pageIndex = 0;
double x = 100;
double y = 700;
double width = 60;
double height = 15;
var choices = new List<string>() { "Car", "Bike", "Airplane" };
// Create combobox form field
var comboboxForm = new ComboboxFormField(name, value, pageIndex, x, y, width, height, choices);
// Add form
pdf.Form.Add(comboboxForm);
pdf.SaveAs("addComboboxForm.pdf");Imports IronPdf
Imports IronSoftware.Forms
Imports System.Collections.Generic
' Instantiate ChromePdfRenderer
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h2>Combobox Form Field</h2>")
' Configure required parameters
Private name As String = "combobox"
Private value As String = "Car"
Private pageIndex As UInteger = 0
Private x As Double = 100
Private y As Double = 700
Private width As Double = 60
Private height As Double = 15
Private choices = New List(Of String)() From {"Car", "Bike", "Airplane"}
' Create combobox form field
Private comboboxForm = New ComboboxFormField(name, value, pageIndex, x, y, width, height, choices)
' Add form
pdf.Form.Add(comboboxForm)
pdf.SaveAs("addComboboxForm.pdf")Output PDF Document
The IronSuite play a crucial role in our operations. These are tools that increase efficiencies across the business including creating floor plans and improving inventory management.
How Do I Create Radio Button Forms?
How Do I Render Radio Buttons From HTML?
Radio buttons in the same group are contained within one form object. Retrieve the field using the FindFormField() method with its name. The Value property contains the selected choice value, or 'None' if unselected. This mirrors HTML radio button behavior.
using IronPdf;
// Radio buttons HTML
string FormHtml = @"
<html>
<body>
<h2>Editable PDF Form</h2>
Choose your preferred travel type: <br>
<input type='radio' name='traveltype' value='Bike'>
Bike <br>
<input type='radio' name='traveltype' value='Car'>
Car <br>
<input type='radio' name='traveltype' value='Airplane'>
Airplane
</body>
</html>
";
// Instantiate Renderer
ChromePdfRenderer Renderer = new ChromePdfRenderer();
Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
Renderer.RenderHtmlAsPdf(FormHtml).SaveAs("radioButtomForm.pdf");Imports IronPdf
' Radio buttons HTML
Private FormHtml As String = "
<html>
<body>
<h2>Editable PDF Form</h2>
Choose your preferred travel type: <br>
<input type='radio' name='traveltype' value='Bike'>
Bike <br>
<input type='radio' name='traveltype' value='Car'>
Car <br>
<input type='radio' name='traveltype' value='Airplane'>
Airplane
</body>
</html>
"
' Instantiate Renderer
Private Renderer As New ChromePdfRenderer()
Renderer.RenderingOptions.CreatePdfFormsFromHtml = True
Renderer.RenderHtmlAsPdf(FormHtml).SaveAs("radioButtomForm.pdf")Output PDF Document
How Do I Add Radio Forms Programmatically?
Add radio button form fields through code. Instantiate a RadioFormField object with required parameters. Use the Add() method of the Form property to add the form. This approach helps when merging PDFs and adding consistent form fields across documents.
using IronPdf;
using IronSoftware.Forms;
// Instantiate ChromePdfRenderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>");
// Configure required parameters
string name = "choice";
string value = "yes";
uint pageIndex = 0;
double x = 100;
double y = 700;
double width = 15;
double height = 15;
// Create the first radio form
var yesRadioform = new RadioFormField(name, value, pageIndex, x, y, width, height);
value = "no";
x = 200;
// Create the second radio form
var noRadioform = new RadioFormField(name, value, pageIndex, x, y, width, height);
pdf.Form.Add(yesRadioform);
pdf.Form.Add(noRadioform);
pdf.SaveAs("addRadioForm.pdf");Imports IronPdf
Imports IronSoftware.Forms
' Instantiate ChromePdfRenderer
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>")
' Configure required parameters
Private name As String = "choice"
Private value As String = "yes"
Private pageIndex As UInteger = 0
Private x As Double = 100
Private y As Double = 700
Private width As Double = 15
Private height As Double = 15
' Create the first radio form
Private yesRadioform = New RadioFormField(name, value, pageIndex, x, y, width, height)
value = "no"
x = 200
' Create the second radio form
Dim noRadioform = New RadioFormField(name, value, pageIndex, x, y, width, height)
pdf.Form.Add(yesRadioform)
pdf.Form.Add(noRadioform)
pdf.SaveAs("addRadioForm.pdf")Output PDF Document
Use the DrawText method to add labels for radio buttons. Learn more about How to Draw Text and Bitmap on PDFs.
How Do I Add Image Forms to PDFs?
Add image form fields through code only. Instantiate an ImageFormField object with required parameters. Use the Add() method of the Form property to add the form. Image forms work well for photo identification or signature capture functionality.
using IronPdf;
using IronSoftware.Forms;
// Instantiate ChromePdfRenderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>");
// Configure required parameters
string name = "image1";
uint pageIndex = 0;
double x = 100;
double y = 600;
double width = 200;
double height = 200;
// Create the image form
ImageFormField imageForm = new ImageFormField(name, pageIndex, x, y, width, height);
pdf.Form.Add(imageForm);
pdf.SaveAs("addImageForm.pdf");Imports IronPdf
Imports IronSoftware.Forms
' Instantiate ChromePdfRenderer
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>")
' Configure required parameters
Private name As String = "image1"
Private pageIndex As UInteger = 0
Private x As Double = 100
Private y As Double = 600
Private width As Double = 200
Private height As Double = 200
' Create the image form
Private imageForm As New ImageFormField(name, pageIndex, x, y, width, height)
pdf.Form.Add(imageForm)
pdf.SaveAs("addImageForm.pdf")Output PDF Document
Output PDF file: View Image Form PDF. Browsers do not support image forms; open in Adobe Acrobat to test this feature.

How Do I Create Unsigned Signature Forms?
Insert an unsigned or empty signature field by creating a signature object. Create a SignatureFormField object and add it using the Add() method of the Form property. Export the PDF with the empty signature field. This enables digital signatures that can be filled later with actual signature data.
using IronPdf;
using IronSoftware.Forms;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>testing</h1>");
// Configure required parameters
string name = "cert";
uint pageIndex = 0;
double x = 100;
double y = 600;
double width = 300;
double height = 100;
// Create signature
SignatureFormField signature = new SignatureFormField(name, pageIndex, x, y, width, height);
// Add signature
pdf.Form.Add(signature);
pdf.SaveAs("signature.pdf");Imports IronPdf
Imports IronSoftware.Forms
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>testing</h1>")
' Configure required parameters
Private name As String = "cert"
Private pageIndex As UInteger = 0
Private x As Double = 100
Private y As Double = 600
Private width As Double = 300
Private height As Double = 100
' Create signature
Private signature As New SignatureFormField(name, pageIndex, x, y, width, height)
' Add signature
pdf.Form.Add(signature)
pdf.SaveAs("signature.pdf")Output PDF Document
Output PDF file: signature.pdf. Browsers do not support signature forms; open in Adobe Acrobat to test this feature. For enhanced security, explore signing PDFs with HSM.

TextFormField
Add
Form
DrawText
CreatePdfFormsFromHtml
CheckboxFormField
Add
Form
ComboboxFormField
Add
Form
FindFormField
Value
RadioFormField
Add
Form
DrawText
ImageFormField
Add
Form
Form
Add
Learn to fill and edit PDF forms programmatically: "How to Fill and Edit PDF Forms". For comprehensive form security, see our guide on PDF permissions and passwords.
Ready to explore more? Check our tutorial: Sign and Secure PDFs
Frequently Asked Questions
How can I create fillable PDF forms in C# using IronPDF?
You can create fillable PDF forms in C# using IronPDF's API, which allows you to add text inputs, checkboxes, radio buttons, comboboxes, image forms, and digital signatures to your PDFs. By providing an HTML form and setting the `RenderingOptions.CreatePdfFormsFromHtml` option to true, you can generate interactive forms quickly.
What types of form fields can I add to PDFs with IronPDF?
IronPDF supports various form fields, including text inputs, checkboxes, radio buttons, comboboxes, image forms, and signature fields. These elements enhance the interactivity and user input capabilities of PDF documents.
Can I design PDF forms programmatically without HTML using IronPDF?
Yes, IronPDF allows you to design PDF forms programmatically by instantiating form field objects like `TextFormField`, `CheckboxFormField`, and `RadioFormField` and adding them to a PDF using the `Add()` method of the `Form` property.
How do I convert HTML with form fields into a fillable PDF using IronPDF?
To convert HTML with form fields into a fillable PDF, use IronPDF’s `RenderHtmlAsPdf` method. Ensure that the `RenderingOptions.CreatePdfFormsFromHtml` is set to true to enable form creation from HTML content.
How can I add a digital signature field to my PDF form using IronPDF?
You can add a digital signature field to your PDF by creating a `SignatureFormField` object and adding it to the document using the `Add()` method. The resulting PDF can be signed later with actual signature data.
Is it possible to integrate images as form fields in PDFs with IronPDF?
Yes, IronPDF allows you to integrate images as form fields by using the `ImageFormField` object. This feature is useful for photo identification or signature captures.
How do I manage checkbox and combobox forms in PDFs with IronPDF?
Checkbox and combobox forms can be created from HTML or programmatically using IronPDF. For checkboxes, instantiate a `CheckboxFormField`, and for comboboxes, use the `ComboboxFormField` object, then add these forms using the `Add()` method.
What options does IronPDF offer for enhancing the security and compliance of PDF forms?
IronPDF supports features such as digital signing, redaction, encryption, and protection to enhance the security and compliance of PDF forms, reducing yearly costs associated with PDF handling.
Can I dynamically populate form fields like comboboxes in PDFs with IronPDF?
Yes, IronPDF allows you to dynamically populate form fields such as comboboxes by using methods to extract data and set `ComboboxFormField` choices programmatically or through HTML rendering.
How can I ensure compatibility of interactive PDF forms across different PDF readers?
When using IronPDF to create interactive forms, it's advised to test features like signature and image fields in Adobe Acrobat, as some browsers may not support all interactive elements. IronPDF's comprehensive features ensure broad compatibility.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.