DocumentDataItem Property
Gets the field data by an index.

Namespace: GroupDocs.Parser.Data
Assembly: GroupDocs.Parser (in GroupDocs.Parser.dll) Version: 21.5.0
Syntax
public FieldData this[
	int index
] { get; }

Parameters

index
Type: SystemInt32
The zero-based index of the field.

Return Value

Type: FieldData
An instance of FieldData class.
Examples

Iteration via all the fields:

C#
for (int i = 0; i < data.Count; i++)
{
    Console.Write(data[i].Name + ": ");
    PageTextArea area = data[i].PageArea as PageTextArea;
    Console.WriteLine(area == null ? "Not a template field" : area.Text);
}

FieldData class represents field data. Depending on the field PageArea property can contain any of the inheritors of PageArea class. For example, ParseForm method extracts only text fields:

C#
// Create the parser
using (Parser parser = new Parser(filePath))
{
    // Extract data from PDF Form
    DocumentData data = parser.ParseForm();
    // Iterate over extracted fields
    for (int i = 0; i < data.Count; i++)
    {
        // Get the extracted field
        FieldData field = data[i];
        // Print the field name
        Console.Write(field.Name + ": ");
        // Check if the field value is a text and print it
        PageTextArea area = field.PageArea as PageTextArea;
        Console.WriteLine(area == null ? "Not a template field" : area.Text);
    }
}
See Also