Class PdfForm
信息
表示 Documentize.PdfForm 插件。用于展平(Flatten)和提取表单数据。也允许获取字段名称。
Represents Documentize.PdfForm plugin. Used to Flatten, Extract Forms Data. Also allows you to Get Fields Names.
public static class PdfFormInheritance
Inherited Members
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
Methods
Extract(ExtractFormDataToDsvOptions)
从 PDF 文档中提取表单数据。
public static ResultContainer Extract(ExtractFormDataToDsvOptions options)Parameters
optionsExtractFormDataToDsvOptions: 包含操作指令的选项对象。
Returns
ResultContainer : 包含操作结果的对象。
Examples
该示例演示如何将表单值导出为 CSV 文件。
// Create ExtractFormDataToDsvOptions object to set instructions
var options = new ExtractFormDataToDsvOptions(',', true);
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_csv_file.csv"));
// Perform the process
PdfForm.Extract(options);Exceptions
如果未设置 options。
Flatten(FlattenFieldsOptions)
在 PDF 文档中展平字段。
public static ResultContainer Flatten(FlattenFieldsOptions options)Parameters
optionsFlattenFieldsOptions: 包含操作指令的选项对象。
Returns
ResultContainer : 包含操作结果的对象。
Examples
该示例演示如何在 PDF 文件中展平字段。
// Create FormFlattenerOptions object to set instructions
var options = new FormFlattenerOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfForm.Flatten(options);该示例演示如何在 PDF 文件中展平字段并跳过第一个字段。
// Get Fields Names
var fieldNames = PdfForm.GetFieldNames(new GetFieldNamesOptions("path_to_your_pdf_file.pdf"));
// Create FormFlattenerOptions object to set instructions
var options = new FormFlattenerOptions();
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Skip 1 field.
options.SkipFields.Add(fieldNames[0]);
// Perform the process
PdfForm.Flatten(options);Exceptions
如果未设置 options。
GetNames(GetFieldNamesOptions)
获取 PDF 文档中的字段名称。
public static List<string> GetNames(GetFieldNamesOptions options)Parameters
optionsGetFieldNamesOptions: 包含操作指令的选项对象。
Returns
PDF 文档中字段名称的列表。
Examples
该示例演示如何从 PDF 文件中获取字段名称。
// Get Fields Names
var fieldNames = PdfForm.GetNames(new GetFieldNamesOptions("path_to_your_pdf_file.pdf"));Remove(RemoveFieldsOptions) : Remove Fields from PDF document.
public static ResultContainer Remove(RemoveFieldsOptions options)Parameters
optionsRemoveFieldsOptions: 包含操作指令的选项对象。
Returns
ResultContainer : 包含操作结果的对象。
Examples
该示例演示如何从 PDF 文件中移除字段。
// Create RemoveFieldsOptions object to set instructions
var options = new RemoveFieldsOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfForm.Remove(options);Exceptions
如果未设置 options。
Namespace: Documentize Assembly: Documentize.dll