---
title: "C# .NET flatten PDF form fields | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/forms/flatten/"
md_url: "https://www.nutrient.io/guides/dotnet/forms/flatten.md"
last_updated: "2026-05-21T17:12:02.203Z"
description: "Learn how to flatten PDF form fields programmatically in C# .NET using Nutrient .NET SDK. Make form field values permanent in the PDF content."
---

# Flatten PDF form fields in C# .NET

Flattening PDF form fields means that you remove form field objects from a document’s internal structure and place their data in the PDF as regular items. This means that form fields are no longer fillable and their data can’t be extracted.

## Flattening all form fields

To flatten all form fields in a PDF document, use the [`FlattenFormFields` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~FlattenFormFields().html):

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Flatten all form fields.
gdpicturePDF.FlattenFormFields();
gdpicturePDF.SaveToFile(@"C:\temp\output.pdf");

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Flatten all form fields.
    gdpicturePDF.FlattenFormFields()
    gdpicturePDF.SaveToFile("C:\temp\output.pdf")
End Using

```

#### Used methods

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

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

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

#### Related topics

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

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

## Flattening form fields on a specified page

To flatten all form fields on a specific page of a PDF document, use the [`FlattenFormFields` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~FlattenFormFields(Int32).html) and specify the page number as its parameter:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Flatten form fields on the second page.
gdpicturePDF.FlattenFormFields(2);
gdpicturePDF.SaveToFile(@"C:\temp\output.pdf");

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Flatten form fields on the second page.
    gdpicturePDF.FlattenFormFields(2)
    gdpicturePDF.SaveToFile("C:\temp\output.pdf")
End Using

```

#### Used methods

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

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

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

#### Related topics

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

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

## Related pages

- [Extract data from PDF form fields in C# .NET](/guides/dotnet/forms/extract-form-data.md)
- [PDF forms in C#.NET](/guides/dotnet/forms.md)
- [Read PDF form fields in C# .NET](/guides/dotnet/forms/read-form-fields.md)
- [PDF form field items in C# .NET](/guides/dotnet/forms/form-field-items.md)
- [Introduction to PDF forms in C#](/guides/dotnet/forms/introduction-what-are-forms.md)
- [Introduction to PDF form fields in C#](/guides/dotnet/forms/introduction-form-fields.md)
- [Add PDF actions to forms using C#](/guides/dotnet/forms/pdf-actions-support.md)

