TX Text Control supports the integration of form fields into documents including form text fields, checkboxes, drop-down boxes and date pickers. Those documents can be deployed using TX Text Control in web or desktop applications using the document editor or the document viewer.

Form fields and TX Text Control

Export Form Fields

Additionally, it is possible to export Adobe PDF documents with included form fields. After loading this document in Adobe Acrobat Reader, the document is recognized automatically as a form and users can complete the fields.

Form fields and TX Text Control

Learn More

Interactive forms in an Adobe PDF document can be used to gather information from end-users. This article shows how to create those forms using TX Text Control in .NET applications using C#.

Creating Adobe PDF Forms in C#

Flatten Form Fields

But what if the document should be exported to PDF without the form field functionality, but plain text. A typical workflow would be the creation of a final document where form fields have been completed already and a resulting document with the actual form field values should be created.

The Remove TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
FormFieldCollection Class
Remove Method
Removes the specified form field from a Text Control document.
method of the FormFieldCollection TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
FormFieldCollection Class
An instance of the FormFieldCollection class contains all form fields in a Text Control document represented through objects of the types TextFormField, CheckFormField and SelectionFormField.
can be used to replace the field with the actual content. The following function iterates through all form fields in order to remove the field functionality:

private void FlattenFormFields(TextControl textControl) {
int fieldCount = textControl1.FormFields.Count;
for (int i = 0; i < fieldCount; i++) {
TextFieldCollectionBase.TextFieldEnumerator fieldEnum =
textControl1.FormFields.GetEnumerator();
fieldEnum.MoveNext();
FormField curField = (FormField)fieldEnum.Current;
textControl1.FormFields.Remove(curField, true);
}
}
view raw test.cs hosted with ❤ by GitHub

The above method can be easily called with a given TextControl TX Text Control .NET for Windows Forms
TXTextControl Namespace
TextControl Class
The TextControl class implements a Windows Forms control with high-level text editing features.
or a ServerTextControl TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
ServerTextControl Class
The ServerTextControl class implements a component that provide high-level text processing features for server-based applications.
instance.

FlattenFormFields(textControl1);
view raw test.cs hosted with ❤ by GitHub

The following screenshot shows the flattened PDF document without the form fields, but the textual content:

Form fields and TX Text Control