Get Field Names

The Documentize PDF Form for .NET allows you to extract interactive form field names from PDF documents, enabling quick identification and streamlined data handling. This tool provides developers with a simple way to list all available fields, making it easier to integrate PDF forms into automated workflows. It is particularly useful when building applications that need to process surveys, contracts, or reports, where knowing the exact field names is essential for accurate data extraction and integration.

Quick Start: Get field names

1// Get field names
2var fieldNames = PdfForm.GetNames(new GetFieldNamesOptions("path_to_your_pdf_file.pdf"));

How to get all field names in a PDF file

To retrieve all form field names from a PDF document, follow these steps:

  1. Create an instance of the GetFieldNamesOptions class.
  2. Provide the input PDF file path (or stream) to the options.
  3. Call the GetNames method to extract the field names.
1// Create GetFieldNamesOptions object to set instructions
2var options = new GetFieldNamesOptions("path_to_your_pdf_file.pdf");
3// Perform the process and get names
4var fieldNames = PdfForm.GetNames(options);

How to get all field names in a PDF stream

1// Prepare input stream
2using var inputStream = File.OpenRead("path_to_your_pdf_file.pdf");
3// Get field names
4var fieldNames = PdfForm.GetNames(new GetFieldNamesOptions(inputStream));

How to set Input property of a GetFieldNamesOptions

This can be useful in loop operations, without creating a new instance.

1var options = new GetFieldNamesOptions();
2// Set input from a file
3options.Input = new FileData("path_to_your_pdf_file.pdf");
4// Or set input from a stream
5// options.Input = new StreamData(stream);
6var results = PdfForm.GetNames(options);

Key Features:

  • Get Field Names: Extracts all interactive form field names from a PDF document for easy identification and processing.
  • Flexible Input Sources: Supports both file paths and streams, allowing seamless integration into diverse .NET workflows.
 English