Get started with IronPDF

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

First Step:
green arrow pointer




Create Forms

IronPDF effortlessly creates PDF documents with embedded form fields of various types. By adding dynamic form elements to an otherwise static PDF document, you can enhance its flexibility and interactivity.

Text Area and Input Forms

Render From HTML

You can easily create text area and input forms to capture user input within your PDF documents. Text area forms provide ample space for displaying and capturing larger amounts of text, while input forms allow users to enter specific values or responses.

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

// This C# script uses IronPdf to convert an HTML form into an editable PDF form. 

// Define an HTML string with a simple form containing input fields and a textarea.
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>
";

// Create a new instance of the ChromePdfRenderer class from the IronPdf library.
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Configure the rendering options to enable form fields in the generated PDF.
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;

// Render the HTML form string as a PDF and save the generated PDF to the specified file path.
renderer.RenderHtmlAsPdf(formHtml).SaveAs("textAreaAndInputForm.pdf");
Imports IronPdf



' This C# script uses IronPdf to convert an HTML form into an editable PDF form. 



' Define an HTML string with a simple form containing input fields and a textarea.

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>

"



' Create a new instance of the ChromePdfRenderer class from the IronPdf library.

Private renderer As New ChromePdfRenderer()



' Configure the rendering options to enable form fields in the generated PDF.

renderer.RenderingOptions.CreatePdfFormsFromHtml = True



' Render the HTML form string as a PDF and save the generated PDF to the specified file path.

renderer.RenderHtmlAsPdf(formHtml).SaveAs("textAreaAndInputForm.pdf")
$vbLabelText   $csharpLabel

Output PDF Document

Add Text Form via Code

The above code example talks about rendering HTML that contains text areas and input forms. However, it is also possible to add a text form field through code. First, instantiate a TextFormField object with the required parameters. Next, use the Add method of the Form property to add the created form.

:path=/static-assets/pdf/content-code-examples/how-to/create-forms-add-input-textarea.cs
using IronPdf;
using IronSoftware.Drawing.Forms;

// This code demonstrates how to create a PDF with a form field using the IronPdf library.
// It involves rendering an HTML page as a PDF and adding an editable form field to it.

// Instantiate ChromePdfRenderer to render HTML as PDF
var renderer = new ChromePdfRenderer();

// Render a simple HTML as PDF document
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>");

// Define parameters for the text form field
string fieldName = "firstname"; // Name of the form field
string defaultValue = "first name"; // Default value of the form field
uint pageIndex = 0; // Page index where the form field will be added; 0 for the first page
double xCoordinate = 100; // X-coordinate for the position of the form field
double yCoordinate = 700; // Y-coordinate for the position of the form field
double fieldWidth = 50; // Width of the form field
double fieldHeight = 15; // Height of the form field

// Create a text form field with the specified parameters
var textForm = new TextFormField(fieldName, defaultValue, pageIndex, xCoordinate, yCoordinate, fieldWidth, fieldHeight);

// Add the text form field to the PDF form
pdf.Form.Add(textForm);

// Save the PDF document with the form field to a file
pdf.SaveAs("addTextForm.pdf");
Imports IronPdf

Imports IronSoftware.Drawing.Forms



' This code demonstrates how to create a PDF with a form field using the IronPdf library.

' It involves rendering an HTML page as a PDF and adding an editable form field to it.



' Instantiate ChromePdfRenderer to render HTML as PDF

Private renderer = New ChromePdfRenderer()



' Render a simple HTML as PDF document

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>")



' Define parameters for the text form field

Private fieldName As String = "firstname" ' Name of the form field

Private defaultValue As String = "first name" ' Default value of the form field

Private pageIndex As UInteger = 0 ' Page index where the form field will be added; 0 for the first page

Private xCoordinate As Double = 100 ' X-coordinate for the position of the form field

Private yCoordinate As Double = 700 ' Y-coordinate for the position of the form field

Private fieldWidth As Double = 50 ' Width of the form field

Private fieldHeight As Double = 15 ' Height of the form field



' Create a text form field with the specified parameters

Private textForm = New TextFormField(fieldName, defaultValue, pageIndex, xCoordinate, yCoordinate, fieldWidth, fieldHeight)



' Add the text form field to the PDF form

pdf.Form.Add(textForm)



' Save the PDF document with the form field to a file

pdf.SaveAs("addTextForm.pdf")
$vbLabelText   $csharpLabel

Output PDF Document

Having a text form field in a PDF without a label might not be very meaningful. To enhance its usefulness, you should add text to the PDF as a label for the form field. IronPdf has you covered. You can achieve this by using the DrawText method. Learn more about How to Draw Text and Bitmap on PDFs.


Checkbox and Combobox Forms

Render From HTML

Similarly, checkbox and combobox forms can be created by rendering from an HTML string, file, or web URL that contains checkboxes and comboboxes. Set the CreatePdfFormsFromHtml property to true to enable the creation of these forms.

Combobox forms provide users with a dropdown selection of options. Users can choose from the available options, offering valuable input within the PDF documents.

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

// This HTML string defines a simple form with a checkbox and a dropdown menu for PDF creation.
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>
";

// Create a new instance of the ChromePdfRenderer class to render HTML into a PDF document.
var renderer = new ChromePdfRenderer();

// Enable the creation of PDF forms from HTML input elements like checkboxes and select dropdowns.
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;

// Render the HTML as a PDF and save it to a file named "checkboxAndComboboxForm.pdf".
var pdfDocument = renderer.RenderHtmlAsPdf(formHtml);

// Save the rendered PDF document to a file.
pdfDocument.SaveAs("checkboxAndComboboxForm.pdf");
Imports IronPdf



' This HTML string defines a simple form with a checkbox and a dropdown menu for PDF creation.

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>

"



' Create a new instance of the ChromePdfRenderer class to render HTML into a PDF document.

Private renderer = New ChromePdfRenderer()



' Enable the creation of PDF forms from HTML input elements like checkboxes and select dropdowns.

renderer.RenderingOptions.CreatePdfFormsFromHtml = True



' Render the HTML as a PDF and save it to a file named "checkboxAndComboboxForm.pdf".

Dim pdfDocument = renderer.RenderHtmlAsPdf(formHtml)



' Save the rendered PDF document to a file.

pdfDocument.SaveAs("checkboxAndComboboxForm.pdf")
$vbLabelText   $csharpLabel

Output PDF Document

Add Form via Code

Checkbox

To add a checkbox form field, first instantiate a CheckboxFormField object with the required parameters. The value parameter of the checkbox will determine whether the form should be checked or not, with "no" value for not checked and "yes" value for checked. Finally, use the Add method of the Form property to add the created form.

:path=/static-assets/pdf/content-code-examples/how-to/create-forms-add-checkbox.cs
// Import the IronPdf library, which is used for creating and manipulating PDF files
using IronPdf;

// Import IronSoftware.Forms for form field handling in PDFs
using IronSoftware.Forms;

// Instantiate a ChromePdfRenderer, which allows rendering of HTML content into a PDF
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Render an HTML string into a new PDF document
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Checkbox Form Field</h2>");

// Configure the parameters for the checkbox form field
string name = "checkbox"; // Name of the form field
string value = "no";      // Default value of the form field
uint pageIndex = 0;       // Page index where the form will be added
double x = 100;           // X-coordinate of the top-left corner of the checkbox
double y = 700;           // Y-coordinate of the top-left corner of the checkbox
double width = 15;        // Width of the checkbox
double height = 15;       // Height of the checkbox

// Create a checkbox form field with the specified parameters
var checkboxForm = new CheckboxFormField(name, value, pageIndex, x, y, width, height);

// Add the checkbox form field to the PDF's form collection
pdf.Form.Add(checkboxForm);

// Save the modified PDF to a file with the specified name
pdf.SaveAs("addCheckboxForm.pdf");
' Import the IronPdf library, which is used for creating and manipulating PDF files

Imports IronPdf



' Import IronSoftware.Forms for form field handling in PDFs

Imports IronSoftware.Forms



' Instantiate a ChromePdfRenderer, which allows rendering of HTML content into a PDF

Private renderer As New ChromePdfRenderer()



' Render an HTML string into a new PDF document

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h2>Checkbox Form Field</h2>")



' Configure the parameters for the checkbox form field

Private name As String = "checkbox" ' Name of the form field

Private value As String = "no" ' Default value of the form field

Private pageIndex As UInteger = 0 ' Page index where the form will be added

Private x As Double = 100 ' X-coordinate of the top-left corner of the checkbox

Private y As Double = 700 ' Y-coordinate of the top-left corner of the checkbox

Private width As Double = 15 ' Width of the checkbox

Private height As Double = 15 ' Height of the checkbox



' Create a checkbox form field with the specified parameters

Private checkboxForm = New CheckboxFormField(name, value, pageIndex, x, y, width, height)



' Add the checkbox form field to the PDF's form collection

pdf.Form.Add(checkboxForm)



' Save the modified PDF to a file with the specified name

pdf.SaveAs("addCheckboxForm.pdf")
$vbLabelText   $csharpLabel

Output PDF Document

Combobox

To add a combobox form field, first instantiate a ComboboxFormField object with the required parameters. Similar to the checkbox form, the value parameter of the combobox determines which choice will be selected. Finally, use the Add method of the Form property to add the created form.

:path=/static-assets/pdf/content-code-examples/how-to/create-forms-add-combobox.cs
using IronPdf;
using IronSoftware.Forms;
using System.Collections.Generic;

// Instantiate ChromePdfRenderer. This object is used to render HTML content as a PDF document.
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Render the specified HTML content as a PDF document.
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Combobox Form Field</h2>");

// Configure parameters for the combobox form field.
// These parameters define the name, value, position, size, and available choices for the combobox.
string name = "combobox";                   // The name of the combobox field.
string value = "Car";                       // The default selected value in the combobox.
uint pageIndex = 0;                         // The index of the page where the combobox will be placed.
double x = 100;                             // The x-coordinate position of the combobox.
double y = 700;                             // The y-coordinate position of the combobox.
double width = 60;                          // The width of the combobox.
double height = 15;                         // The height of the combobox.
var choices = new List<string> { "Car", "Bike", "Airplane" }; // The list of available choices for the combobox.

// Create a combobox form field using the specified parameters.
var comboboxForm = new ComboboxFormField(name, value, pageIndex, x, y, width, height, choices);

// Add the created combobox form field to the PDF document's form fields.
pdf.Form.Add(comboboxForm);

// Save the modified PDF document to a file.
pdf.SaveAs("addComboboxForm.pdf");
Imports IronPdf

Imports IronSoftware.Forms

Imports System.Collections.Generic



' Instantiate ChromePdfRenderer. This object is used to render HTML content as a PDF document.

Private renderer As New ChromePdfRenderer()



' Render the specified HTML content as a PDF document.

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h2>Combobox Form Field</h2>")



' Configure parameters for the combobox form field.

' These parameters define the name, value, position, size, and available choices for the combobox.

Private name As String = "combobox" ' The name of the combobox field.

Private value As String = "Car" ' The default selected value in the combobox.

Private pageIndex As UInteger = 0 ' The index of the page where the combobox will be placed.

Private x As Double = 100 ' The x-coordinate position of the combobox.

Private y As Double = 700 ' The y-coordinate position of the combobox.

Private width As Double = 60 ' The width of the combobox.

Private height As Double = 15 ' The height of the combobox.

Private choices = New List(Of String) From {"Car", "Bike", "Airplane"} ' The list of available choices for the combobox.



' Create a combobox form field using the specified parameters.

Private comboboxForm = New ComboboxFormField(name, value, pageIndex, x, y, width, height, choices)



' Add the created combobox form field to the PDF document's form fields.

pdf.Form.Add(comboboxForm)



' Save the modified PDF document to a file.

pdf.SaveAs("addComboboxForm.pdf")
$vbLabelText   $csharpLabel

Output PDF Document


Radio buttons Forms

Render From HTML

When working with radio button forms in IronPDF, radio buttons of the same group are contained within one form object. You can retrieve that form by inputting its name into the FindFormField method. If any of the radio choices is selected, the Value property of that form will have that value; otherwise, it will have a value of 'None'.

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

/* 
 * This C# script demonstrates how to use the IronPdf library 
 * to create a PDF with a form containing radio buttons.
 * The form allows the user to choose a preferred travel type.
 */

// HTML content for the form with radio buttons
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 a PDF renderer using IronPdf's ChromePdfRenderer
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Enable creation of PDF forms from HTML form elements
renderer.RenderingOptions.CreatePdfFormsFromHtml = true;

// Render the HTML as a PDF
var pdfDocument = renderer.RenderHtmlAsPdf(formHtml);

// Save the rendered PDF to the specified file path
pdfDocument.SaveAs("radioButtonForm.pdf");
Imports IronPdf



' 

' * This C# script demonstrates how to use the IronPdf library 

' * to create a PDF with a form containing radio buttons.

' * The form allows the user to choose a preferred travel type.

' 



' HTML content for the form with radio buttons

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 a PDF renderer using IronPdf's ChromePdfRenderer

Private renderer As New ChromePdfRenderer()



' Enable creation of PDF forms from HTML form elements

renderer.RenderingOptions.CreatePdfFormsFromHtml = True



' Render the HTML as a PDF

Dim pdfDocument = renderer.RenderHtmlAsPdf(formHtml)



' Save the rendered PDF to the specified file path

pdfDocument.SaveAs("radioButtonForm.pdf")
$vbLabelText   $csharpLabel

Output PDF Document

Add Radio Form via Code

Similarly, a radio button form field can also be added through code. First, instantiate a RadioFormField object with the required parameters. Next, use the Add method of the Form property to add the created form.

:path=/static-assets/pdf/content-code-examples/how-to/create-forms-add-radiobutton.cs
using IronPdf;
using IronSoftware.Forms;

// Instantiate ChromePdfRenderer to create PDFs from HTML content
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Render an HTML string as a PDF document
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>");

// Configure parameters for creating form fields
string name = "choice";         // Name of the radio button group
string valueYes = "yes";        // Value for 'Yes' radio button
string valueNo = "no";          // Value for 'No' radio button
uint pageIndex = 0;             // Index of the page to add the radio buttons
double xYes = 100;              // X-coordinate for the 'Yes' radio button
double y = 700;                 // Y-coordinate for both radio buttons
double width = 15;              // Width of the radio button
double height = 15;             // Height of the radio button
double xNo = 200;               // X-coordinate for the 'No' radio button

// Create the first radio form field for the "Yes" option
RadioFormField yesRadioForm = new RadioFormField(name, valueYes, pageIndex, xYes, y, width, height);

// Create the second radio form field for the "No" option
RadioFormField noRadioForm = new RadioFormField(name, valueNo, pageIndex, xNo, y, width, height);

// Add the radio form fields to the PDF form
pdf.Form.Add(yesRadioForm);
pdf.Form.Add(noRadioForm);

// Save the PDF document to a file
pdf.SaveAs("addRadioForm.pdf");
Imports IronPdf

Imports IronSoftware.Forms



' Instantiate ChromePdfRenderer to create PDFs from HTML content

Private renderer As New ChromePdfRenderer()



' Render an HTML string as a PDF document

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>")



' Configure parameters for creating form fields

Private name As String = "choice" ' Name of the radio button group

Private valueYes As String = "yes" ' Value for 'Yes' radio button

Private valueNo As String = "no" ' Value for 'No' radio button

Private pageIndex As UInteger = 0 ' Index of the page to add the radio buttons

Private xYes As Double = 100 ' X-coordinate for the 'Yes' radio button

Private y As Double = 700 ' Y-coordinate for both radio buttons

Private width As Double = 15 ' Width of the radio button

Private height As Double = 15 ' Height of the radio button

Private xNo As Double = 200 ' X-coordinate for the 'No' radio button



' Create the first radio form field for the "Yes" option

Private yesRadioForm As New RadioFormField(name, valueYes, pageIndex, xYes, y, width, height)



' Create the second radio form field for the "No" option

Private noRadioForm As New RadioFormField(name, valueNo, pageIndex, xNo, y, width, height)



' Add the radio form fields to the PDF form

pdf.Form.Add(yesRadioForm)

pdf.Form.Add(noRadioForm)



' Save the PDF document to a file

pdf.SaveAs("addRadioForm.pdf")
$vbLabelText   $csharpLabel

Output PDF Document

As a final touch, use the DrawText method to add labels for the radio buttons. Learn more about How to Draw Text and Bitmap on PDFs.


Image Forms via Code

Image form field can only be added through code. First, instantiate a ImageFormField object with the required parameters. Next, use the Add method of the Form property to add the created form.

:path=/static-assets/pdf/content-code-examples/how-to/create-forms-add-image.cs
// Import the necessary libraries for handling PDF operations
using IronPdf;
using IronSoftware.Forms;

// Instantiate a ChromePdfRenderer object, which is used for rendering HTML content into a PDF file
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Render a simple HTML into a PDF document. The HTML contains a header tag with text "Editable PDF Form".
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>");

// Define parameters for an image form field in the PDF
// 'name': the identifier for the image form field
string name = "image1";

// 'pageIndex': the index of the page where the form field should be added, starting with 0 as the first page
uint pageIndex = 0;

// 'x' and 'y': the coordinates where the image form field will be placed on the page
double x = 100;
double y = 600;

// 'width' and 'height': the dimensions of the image form field
double width = 200;
double height = 200;

// Create an ImageFormField object using the specified parameters
ImageFormField imageForm = new ImageFormField(name, pageIndex, x, y, width, height);

// Add the image form field to the PDF's form object
pdf.Form.Add(imageForm);

// Save the updated PDF document to a file called "addImageForm.pdf"
pdf.SaveAs("addImageForm.pdf");
' Import the necessary libraries for handling PDF operations

Imports IronPdf

Imports IronSoftware.Forms



' Instantiate a ChromePdfRenderer object, which is used for rendering HTML content into a PDF file

Private renderer As New ChromePdfRenderer()



' Render a simple HTML into a PDF document. The HTML contains a header tag with text "Editable PDF Form".

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h2>Editable PDF Form</h2>")



' Define parameters for an image form field in the PDF

' 'name': the identifier for the image form field

Private name As String = "image1"



' 'pageIndex': the index of the page where the form field should be added, starting with 0 as the first page

Private pageIndex As UInteger = 0



' 'x' and 'y': the coordinates where the image form field will be placed on the page

Private x As Double = 100

Private y As Double = 600



' 'width' and 'height': the dimensions of the image form field

Private width As Double = 200

Private height As Double = 200



' Create an ImageFormField object using the specified parameters

Private imageForm As New ImageFormField(name, pageIndex, x, y, width, height)



' Add the image form field to the PDF's form object

pdf.Form.Add(imageForm)



' Save the updated PDF document to a file called "addImageForm.pdf"

pdf.SaveAs("addImageForm.pdf")
$vbLabelText   $csharpLabel

Output PDF Document

Output PDF file: View Image Form PDF. Browsers do not support image forms; please open in Adobe Acrobat to try the feature out.

Image Form

Unsigned Signature Forms via Code

To insert an unsigned or empty signature field, start by creating a signature object. Then, access the Form property of the target PDF and use the Add method to insert the signature object. Lastly, export the PDF with the empty signature field.

:path=/static-assets/pdf/content-code-examples/how-to/signing-unsigned-signature.cs
using IronPdf;
using IronPdf.Forms; // Corrected namespace import for forms

// This code snippet demonstrates how to create a PDF with an embedded signature field 
// using the IronPdf library.

// Create a ChromePdfRenderer instance to render HTML content as a PDF document.
ChromePdfRenderer renderer = new ChromePdfRenderer();

// Render a simple HTML string to a PDF document.
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>testing</h1>");

// Configure the parameters for the signature form field.
string name = "cert";        // The name for the signature field.
int pageIndex = 0;           // Changed uint to int for compatibility, page index where the signature should be placed.
double x = 100;              // The x-coordinate of the signature's position.
double y = 600;              // The y-coordinate of the signature's position.
double width = 300;          // The width of the signature field.
double height = 100;         // The height of the signature field.

// Create a SignatureFormField object using the configured parameters.
SignatureFormField signature = new SignatureFormField(name, pageIndex, x, y, width, height);

// Add the signature form field to the PDF document.
pdf.Form.Add(signature);

// Save the PDF document with the embedded signature to the specified file path.
pdf.SaveAs("signature.pdf");
Imports IronPdf

Imports IronPdf.Forms ' Corrected namespace import for forms



' This code snippet demonstrates how to create a PDF with an embedded signature field 

' using the IronPdf library.



' Create a ChromePdfRenderer instance to render HTML content as a PDF document.

Private renderer As New ChromePdfRenderer()



' Render a simple HTML string to a PDF document.

Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>testing</h1>")



' Configure the parameters for the signature form field.

Private name As String = "cert" ' The name for the signature field.

Private pageIndex As Integer = 0 ' Changed uint to int for compatibility, page index where the signature should be placed.

Private x As Double = 100 ' The x-coordinate of the signature's position.

Private y As Double = 600 ' The y-coordinate of the signature's position.

Private width As Double = 300 ' The width of the signature field.

Private height As Double = 100 ' The height of the signature field.



' Create a SignatureFormField object using the configured parameters.

Private signature As New SignatureFormField(name, pageIndex, x, y, width, height)



' Add the signature form field to the PDF document.

pdf.Form.Add(signature)



' Save the PDF document with the embedded signature to the specified file path.

pdf.SaveAs("signature.pdf")
$vbLabelText   $csharpLabel

Output PDF Document

Output PDF file: signature.pdf. Browsers do not support signature forms; please open in Adobe Acrobat to try the feature out.

Image Form

Learn how to fill and edit PDF forms programmatically in the following article: "How to Fill and Edit PDF Forms".

Frequently Asked Questions

What types of form elements are supported when creating interactive PDF forms?

IronPDF supports a variety of form elements including input fields, text areas, checkboxes, comboboxes, radio buttons, and image forms.

How can I create a PDF form using HTML?

You can create PDF forms using HTML by defining form elements in HTML and converting it to PDF using IronPDF's HtmlToPdf.GeneratePdf method.

Can I programmatically add form fields to a PDF?

Yes, you can programmatically add various form fields such as text, checkbox, combobox, radio, image, and signature fields using IronPDF's API.

How do I add a text form field to a PDF using code?

To add a text form field, instantiate a TextFormField object and use the Add method of the Form property to include it in the PDF.

Is it possible to create a checkbox form in a PDF?

Yes, you can create a checkbox form by either converting HTML containing checkbox elements or programmatically using a CheckboxFormField object.

How can I create a combobox form in a PDF?

Combobox forms can be created from HTML containing select tags or programmatically using a ComboboxFormField object with specified options.

What is the process to add radio buttons to a PDF form?

Radio buttons can be added by converting HTML with radio inputs or programmatically by creating a RadioFormField object and adding it to the PDF.

Is adding image fields to a PDF form supported?

Yes, IronPDF supports adding image fields programmatically by using an ImageFormField object and adding it to the PDF document.

How can I add an unsigned signature field in a PDF?

You can add an unsigned signature field by creating a SignatureFormField object and using the Add method to include it in the PDF.

Where can I learn more about editing PDF forms?

You can learn more about editing PDF forms by visiting the guide on 'How to Fill and Edit PDF Forms' available on the IronPDF website.

Chaknith related to Output PDF Document
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.