PDF Form
展平表单字段
将交互式 PDF 表单转换为不可编辑的文档,使其免受未授权的修改
将交互式 PDF 表单转换为不可编辑的文档,使其免受未授权的修改
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.
To flatten form fields in a PDF document, follow these steps:
FlattenFieldsOptions class.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);You can get information how many fields contains a document.
1// Get Fields Names
2var fieldNames = PdfForm.GetNames(new GetFieldNamesOptions("path_to_your_pdf_file.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);