In TX Text Control X19, the DocumentServer will be extended with a new namespace: TXTextControl.DocumentServer.PDF. This namespace is the new home for PDF specific tasks that doesn't require a connected Text Control.

Extracting Forms Data

Interactive forms in the Adobe PDF format are also known as AcroForm - the de-facto standard for PDF forms processing. The forms can be created and exported using TX Text Control, so that end-users can fill-out these form fields in Acrobat Reader or other applications.

A new feature of TX Text Control X19 allows the easy extraction of form field data to collect results from completed documents.

Import FormField Objects

The following code shows how to get all AcroForm fields from a physical PDF document using the GetAcroFormFields method that accepts file names and byte arrays:

FormField[] acroForms =
TXTextControl.DocumentServer.PDF.Forms.GetAcroFormFields("form.pdf");
foreach (FormField field in acroForms)
{
switch (field)
{
case TXTextControl.DocumentServer.PDF.AcroForms.FormTextField textField:
Console.WriteLine(textField.Value);
break;
case TXTextControl.DocumentServer.PDF.AcroForms.FormCheckBox checkBoxField:
Console.WriteLine(checkBoxField.IsChecked);
break;
case TXTextControl.DocumentServer.PDF.AcroForms.FormComboBox comboBoxField:
foreach(var item in comboBoxField.Options)
Console.WriteLine(item);
break;
}
}
view raw test.cs hosted with ❤ by GitHub

The return value is an array of FormField objects that contains all fields of the document:

Importing AcroForms fields

The above code shows how to loop through this array and to cast those types in a switch/case statement to get the proper values from those fields.

This new feature allows you to support the complete PDF forms workflow where TX Text Control can be used to:

  • Create PDF fillable form documents.
  • Share those documents.
  • Collect and analyze completed forms.

Stay tuned for more innovative document processing features of TX Text Control X19!