---
title: "Edit PDF form fields in C# .NET | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/forms/create-edit-and-remove/edit-fields/"
md_url: "https://www.nutrient.io/guides/dotnet/forms/create-edit-and-remove/edit-fields.md"
last_updated: "2026-05-15T19:10:04.984Z"
description: "Learn how to edit existing PDF form fields programmatically in C# .NET using Nutrient .NET SDK. Modify properties and values of form fields."
---

# Edit PDF form fields in C# .NET

To edit a form field, use one of the methods starting with the `SetFormField` prefix. All these methods require the form field ID as their parameter. Any additional parameters depend on the method you want to use. These methods can change the following areas of a form field, among others:

- Appearance

- Content

- Function properties

To edit a form field, follow the steps below:

1. Create a `GdPicturePDF` object.

2. Load the PDF file with the [`LoadFromFile` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~LoadFromFile.html).

3. Determine the field ID. For more information, see the [get field ID](https://www.nutrient.io/guides/dotnet/forms/create-edit-and-remove/get-field-id.md) guide.

4. Modify the form field with a method starting with the `SetFormField` prefix.

5. Save the PDF document to a file with the [`SaveToFile` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SaveToFile.html).

To change the font size and set the background of all text box fields in the document to light blue, use the following code:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Get the number of form fields.
int fieldCount = gdpicturePDF.GetFormFieldsCount();
// Loop through all form fields.
for (int i = 0; i < fieldCount; i++)
{
    // Get the field ID of each form field.
    int fieldID = gdpicturePDF.GetFormFieldId(i);
    // Check if the current field is a text box.
    if (gdpicturePDF.GetFormFieldType(fieldID) == PdfFormFieldType.PdfFormFieldTypeText)
    {
        // Get the current font size of the form field.
        float fontSize = gdpicturePDF.GetFormFieldFontSize(fieldID);
        // Increase the form field's font size by two points.
        gdpicturePDF.SetFormFieldFontSize(fieldID, fontSize + 2);
        // Set the form field's background to light blue.
        gdpicturePDF.SetFormFieldBackgroundColor(fieldID, 173, 216, 230);
    }
}
gdpicturePDF.SaveToFile(@"C:\temp\output.pdf");

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Get the number of form fields.
    Dim fieldCount As Integer = gdpicturePDF.GetFormFieldsCount()
    ' Loop through all form fields.
    For i = 0 To fieldCount - 1
        ' Get the field ID of each form field.
        Dim fieldID As Integer = gdpicturePDF.GetFormFieldId(i)
        ' Check if the current field is a text box.
        If gdpicturePDF.GetFormFieldType(fieldID) Is PdfFormFieldType.PdfFormFieldTypeText Then
            ' Get the current font size of the form field.
            Dim fontSize As Single = gdpicturePDF.GetFormFieldFontSize(fieldID)
            ' Increase the form field's font size by two points.
            gdpicturePDF.SetFormFieldFontSize(fieldID, fontSize + 2)
            ' Set the form field's background to light blue.
            gdpicturePDF.SetFormFieldBackgroundColor(fieldID, 173, 216, 230)
        End If
    Next
    gdpicturePDF.SaveToFile("C:\temp\output.pdf")
End Using

```

#### Used Methods

- [`GetFormFieldFontSize`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~GetFormFieldFontSize.html)

- [`GetFormFieldId`]

- [`GetFormFieldsCount`]

- [`GetFormFieldType`]

- [`LoadFromFile`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~LoadFromFile.html)

- [`SaveToFile`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SaveToFile.html)

- [`SetFormFieldBackgroundColor`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetFormFieldBackgroundColor.html)

- [`SetFormFieldFontSize`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetFormFieldFontSize.html)

#### Related Topics

- [Load a File](/guides/dotnet/load-a-file.md)

- [Save a File](/guides/dotnet/save-a-file.md)
---

## Related pages

- [Create a fillable PDF form in C# .NET](/guides/dotnet/forms/create-edit-and-remove/create-fillable-form.md)
- [Add a signature field in PDF](/guides/dotnet/forms/create-edit-and-remove/add-signature-field.md)
- [Remove form fields from PDFs in C# .NET](/guides/dotnet/forms/create-edit-and-remove/remove-fields.md)
- [Get the PDF form field ID in C# .NET](/guides/dotnet/forms/create-edit-and-remove/get-field-id.md)

