---
title: "Filling PDF form fields | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/csharp/editor/fill-pdf-form/"
md_url: "https://www.nutrient.io/guides/dotnet/csharp/editor/fill-pdf-form.md"
last_updated: "2026-10-08T00:00:00.000Z"
description: "How to fill PDF form fields programmatically using Nutrient .NET SDK."
---

# Filling PDF form fields

Use PDF form filling to set field values from your application data.

Common use cases include:

- Prepopulating onboarding or registration forms

- Filling claim and compliance forms from backend systems

- Running batch form generation from CSV or database records

- Building template-based document assembly pipelines

In this guide, you'll fill:

- Text fields

- Checkboxes

- Radio button groups

- Combo boxes

- List boxes

[Download sample](https://www.nutrient.io/downloads/samples/csharp/fill-pdf-form.zip)

## How Nutrient helps

Nutrient.NET SDK handles form field access, type-specific operations, and value validation.

The SDK handles:

- PDF form field dictionaries and field type detection

- Low-level value and method validation

- Hierarchy traversal for nested fields

- State synchronization for selection controls

## Complete implementation

This example fills multiple form field types in one workflow.

```csharp

using Nutrient;

```

## Opening a document with form fields

Open the document with a [using statement](https://learn.microsoft.com/dotnet/csharp/language-reference/statements/using), create an editor with `PdfEditor.Edit(document)`, and get all form fields via `editor.FormFieldCollection`. Use the collection for lookup by fully qualified name. Inspect actual field names first (for example, print `FullName` for the fields you look up) before applying targeted updates:

```csharp

try
{
    using Document document = Document.Open("input_forms.pdf");
    using PdfEditor editor = PdfEditor.Edit(document);
    var formFields = editor.FormFieldCollection;

```

## Filling a text field

Find a text field by full name, verify that it exists and has the expected type, and assign the value with the `Value` property. `FindByFullName()` returns the concrete field subtype, such as `PdfTextField` or `PdfCheckBoxField`, or `null` when no field has that name. The inherited `Value` property writes the value for every field type — selection controls take the export value of the choice:

```csharp

    var textField = formFields.FindByFullName("Text1");
    if (textField!= null && textField.FieldType == PdfFormFieldType.Text)
    {
        textField.Value = "John Doe";
    }

```

## Checking a checkbox

Find a checkbox field, verify the type, and assign its on-state export value. Checkbox export values are often `"On"` or `"Yes"` — the sample form uses `"Yes"`:

```csharp

    var checkbox = formFields.FindByFullName("Check1");
    if (checkbox!= null && checkbox.FieldType == PdfFormFieldType.CheckBox)
    {
        checkbox.Value = "Yes";
    }

```

## Selecting a radio button option

Find a radio group, verify the type, and assign one of its option export values:

```csharp

    var radioGroup = formFields.FindByFullName("RadioGroup1");
    if (radioGroup!= null && radioGroup.FieldType == PdfFormFieldType.RadioButton)
    {
        radioGroup.Value = "Option2";
    }

```

## Selecting an item in a combo box

Find a combo box field, verify the type, and assign the export value of the choice you want.

Values must match a valid export value exactly:

```csharp

    var comboBox = formFields.FindByFullName("Dropdown1");
    if (comboBox!= null && comboBox.FieldType == PdfFormFieldType.ComboBox)
    {
        comboBox.Value = "Germany";
    }

```

## Selecting an item in a list box

Find a list box field, verify the type, and assign the export value of the choice you want. The generic `Value` property selects a single value; multi-select isn't yet supported in the.NET SDK:

```csharp

    var listBox = formFields.FindByFullName("List1");
    if (listBox!= null && listBox.FieldType == PdfFormFieldType.ListBox)
    {
        listBox.Value = "Technology";
    }

```

## Filling several fields in one pass

Apply type-based updates to a list of known field names. Process only terminal, non-read-only fields:

```csharp

    foreach (var fullName in new[] { "Text1", "Check1" })
    {
        var field = formFields.FindByFullName(fullName);
        if (field!= null && field.IsTerminal &&!field.IsReadOnly)
        {
            var fieldType = field.FieldType;

            if (fieldType == PdfFormFieldType.Text)
            {
                field.Value = "Sample Value";
            }
            else if (fieldType == PdfFormFieldType.CheckBox)
            {
                field.Value = "Yes";
            }
        }
    }

```

## Saving the filled form

Save the output PDF.

In this sample:

- `SaveAs("output.pdf")` writes a new file.

- The `using` statements release the editor and document handles.

- `NutrientException` handles runtime failures.

```csharp

    editor.SaveAs("output.pdf");
    Console.WriteLine("Successfully filled form fields");
}
catch (NutrientException e)
{
    Console.Error.WriteLine($"Error: {e.Message}");
    Environment.Exit(1);
}

```

## Conclusion

Use this workflow to fill PDF form fields:

1. Open the document, create a PDF editor, and retrieve the form field collection with the `FormFieldCollection` property.

2. Use `FindByFullName()` to locate specific fields by their fully qualified names (including hierarchy).

3. Verify field types with the `FieldType` property before performing field-specific operations.

4. Fill text fields by setting `Value` to `"..."`.

5. Fill checkbox, radio, combo, and list controls by setting `Value` to the control's export values.

6. For checkbox and radio controls, use valid export values (for example, checkbox values are often `"On"` or `"Yes"`).

7. For combo/list controls, values must match available option text/export values exactly.

8. Batch-fill by walking a list of field names with conditional logic using `IsTerminal` and `FieldType`.

9. Save the document with `SaveAs()` to persist all filled field values.

10. Handle exceptions with try-catch blocks for robust error recovery in production workflows.

11. The `using` statements release the editor and document handles.

> Field names used in this sample (`Text1`, `Check1`, `RadioGroup1`, `Dropdown1`, `List1`) match the sample input form. Inspect actual field names in your PDF first and update lookups accordingly — method calls on a field looked up by a name that doesn't exist throw a `NutrientException`.

For related form workflows, refer to the [.NET SDK editor guides](https://www.nutrient.io/guides/dotnet/csharp/editor.md).
---

## Related pages

- [Nutrient .NET SDK editor guides](/guides/dotnet/csharp/editor.md)
- [Adding annotations to a PDF document](/guides/dotnet/csharp/editor/add-annotations-to-pdf.md)
- [Adding a custom page to a PDF document](/guides/dotnet/csharp/editor/add-custom-page-to-pdf.md)
- [Adding interactive form fields to a PDF document](/guides/dotnet/csharp/editor/add-form-fields-to-pdf.md)
- [Adding free text annotations to a PDF document](/guides/dotnet/csharp/editor/add-freetext-annotations-to-pdf.md)
- [Adding invisible digital signatures to a PDF document](/guides/dotnet/csharp/editor/add-invisible-signature-to-pdf.md)
- [Adding link annotations to a PDF document](/guides/dotnet/csharp/editor/add-link-annotations-to-pdf.md)
- [Adding redaction annotations to a PDF document](/guides/dotnet/csharp/editor/add-redaction-annotations-to-pdf.md)
- [Adding shape annotations to a PDF document](/guides/dotnet/csharp/editor/add-shape-annotations-to-pdf.md)
- [Adding stamp annotations to a PDF document](/guides/dotnet/csharp/editor/add-stamp-annotations-to-pdf.md)
- [Adding sticky note annotations to a PDF document](/guides/dotnet/csharp/editor/add-sticky-note-annotations-to-pdf.md)
- [Adding text markup annotations to a PDF document](/guides/dotnet/csharp/editor/add-text-markup-annotations-to-pdf.md)
- [Adding visible digital signatures to a PDF document](/guides/dotnet/csharp/editor/add-visible-signature-to-pdf.md)
- [Advanced digital signature workflows](/guides/dotnet/csharp/editor/advanced-digital-signatures.md)
- [Detecting and adding form fields to a PDF document](/guides/dotnet/csharp/editor/detect-and-add-form-fields.md)
- [Editing PDF form fields](/guides/dotnet/csharp/editor/editing-pdf-form-fields.md)
- [Editing PDF metadata with Nutrient .NET SDK](/guides/dotnet/csharp/editor/editing-pdf-metadata.md)
- [Managing PDF page order](/guides/dotnet/csharp/editor/manage-pdf-page-order.md)
- [Merging PDFs](/guides/dotnet/csharp/editor/merge-pdf-into-other-pdf.md)

