Fill in PDF interactive forms

With GemBox.Pdf you can fill in various types of form fields, such as text, radio button, check box, combo box, and list box in C# and VB.NET, as shown in the following example.

using GemBox.Pdf;

class Program
{
    static void Main()
    {
        // If using the Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var document = PdfDocument.Load("%#Form.pdf%"))
        {
            document.Form.Fields["FullName"].Value = "Jane Doe";
            document.Form.Fields["ID"].Value = "0123456789";
            document.Form.Fields["Gender"].Value = "Female";
            document.Form.Fields["Married"].Value = "Yes";
            document.Form.Fields["City"].Value = "Berlin";
            document.Form.Fields["Language"].Value = new string[] { "German", "Italian" };
            document.Form.Fields["Notes"].Value = "Notes first line\rNotes second line\rNotes third line";

            document.Save("FormFilled.pdf");
        }
    }
}
Imports GemBox.Pdf

Module Program

    Sub Main()

        ' If using the Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Using document = PdfDocument.Load("%#Form.pdf%")

            document.Form.Fields("FullName").Value = "Jane Doe"
            document.Form.Fields("ID").Value = "0123456789"
            document.Form.Fields("Gender").Value = "Female"
            document.Form.Fields("Married").Value = "Yes"
            document.Form.Fields("City").Value = "Berlin"
            document.Form.Fields("Language").Value = New String() {"German", "Italian"}
            document.Form.Fields("Notes").Value = "Notes first line" & vbCr & "Notes second line" & vbCr & "Notes third line"

            document.Save("FormFilled.pdf")
        End Using
    End Sub
End Module
PDF interactive form filled in with GemBox.Pdf
Screenshot of a PDF interactive form filled in with GemBox.Pdf

The example above doesn't fill in a signature field. Signature field fill-in and customization is shown in the Digital Signature examples.

The Read Form example shows how to read values and the Export Form example shows how to export values of filled-in form fields using GemBox.Pdf.

See also


Next steps

GemBox.Pdf is a .NET component that enables developers to read, merge and split PDF files or execute low-level object manipulations from .NET applications in a simple and efficient way.

Download Buy