Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Silverlight | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

Flatten Form Fields

The form field flattening feature removes all fields but preserves their content in the document. After this operation the document no longer can be edited. This functionality was added in R2 2021 version.

There are two methods that you can use for this. One to flatten all fields and one to flatten a single field. The bellow examples demonstrate how to use them.

Using the FlattenFormFields method

The FlattenFormFields method does not take any parameters and will flatten all fields inside the document.

Example 1: Flatten all fields

RadFixedDocument document = GetFixedDocument(); 
document.AcroForm.FlattenFormFields(); 

Using the FlattenFormField method

The FlattenFormField method takes the field that should be flattened as a parameter. The field must belong to the same document.

Example 2: Flatten single field

RadFixedDocument document = GetFixedDocument(); 
string fieldName = "TextBoxField"; 
 
FormField field = document.AcroForm.FormFields.Where(n => n.Name == fieldName).FirstOrDefault(); 
if (field != null) 
{ 
    document.AcroForm.FlattenFormField(field); 
} 
In this article