PDF Form Flattener

The Documentize PDF Form Flattener for .NET plugin is designed 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 FormFlattenerOptions class.
  2. Add the input and output files to the options.
  3. Call the Process method to perform the flattening operation.
1// Create FormFlattenerOptions object to set instructions
2var options = new FormFlattenerOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
7// Perform the process
8FormFlattener.Process(options);

How to Get all Fields in a PDF

You can get information how many fields contains a document.

1// Get Fields Names
2var fieldNames = FormFlattener.GetFieldNames("path_to_your_pdf_file.pdf");

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 = FormFlattener.GetFieldNames("path_to_your_pdf_file.pdf");
 3// Create FormFlattenerOptions object to set instructions
 4var options = new FormFlattenerOptions();
 5options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
 7// Skip 1 field.
 8options.SkipFields.Add(fieldNames[0]);
 9// Perform the process
10FormFlattener.Process(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.
  • Flatten Get Fields Names: Get fields names in a PDF.
 English