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 PdfForm

Inheritance

objectPdfForm

Inherited Members

Methods

Extract(ExtractFormDataToDsvOptions)

从 PDF 文档中提取表单数据。

public static ResultContainer Extract(ExtractFormDataToDsvOptions options)

Parameters

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

ArgumentException

如果未设置 options。

Flatten(FlattenFieldsOptions)

在 PDF 文档中展平字段。

public static ResultContainer Flatten(FlattenFieldsOptions options)

Parameters

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

ArgumentException

如果未设置 options。

GetNames(GetFieldNamesOptions)

获取 PDF 文档中的字段名称。

public static List<string> GetNames(GetFieldNamesOptions options)

Parameters

Returns

List<string>

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

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

ArgumentException

如果未设置 options。

Namespace: Documentize Assembly: Documentize.dll

 中文