PDF Form

Flatten Form Fields

Convert interactive PDF forms into non-editable documents, making them secure from unauthorized modifications

Get Field Names

Extract interactive form field names from PDF documents, enabling quick identification and streamlined data handling

Subsections of PDF Form

Flatten Form Fields

The Documentize PDF Form for .NET allows you to convert interactive PDF forms into non-editable documents, making them secure from unauthorized modifications. This tool transforms form fields into static content, enhancing the security of your PDF documents. It is particularly useful when you need to secure contracts, agreements, or any document where form fields must remain unchanged.

How to Flatten Form Fields in a PDF

To flatten form fields in a PDF document, follow these steps:

  1. Create an instance of the FlattenFieldsOptions class.
  2. Add the input and output files to the options.
  3. Call the Flatten method to perform the flattening operation.
​
1// Create FlattenFieldsOptions object to set instructions
2var options = new FlattenFieldsOptions();
3// Add input file path
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
7// Perform the process
8PdfForm.Flatten(options);

How to Flatten everything except the first Field in a PDF

You can selectively flatten only specific form fields based on criteria such as the field’s position or name.

​
 1// Get Fields Names
 2var fieldNames = PdfForm.GetNames(new GetFieldNamesOptions("path_to_your_pdf_file.pdf"));
 3// Create FlattenFieldsOptions object to set instructions
 4var options = new FlattenFieldsOptions();
 5options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
 6options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
 7// Skip 1 field.
 8options.SkipFields.Add(fieldNames[0]);
 9// Perform the process
10PdfForm.Flatten(options);

Key Features:

  • Flatten All Form Fields: Converts interactive form fields into non-editable static content.
  • Flatten Selected Fields: Optionally flatten specific fields in a PDF while keeping others editable.

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