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

继承

objectPdfForm

继承的成员

方法

Extract(ExtractFormDataToDsvOptions)

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

public static ResultContainer Extract(ExtractFormDataToDsvOptions options)

参数

返回

ResultContainer :包含操作结果的对象。

示例

此示例演示如何将表单值导出为 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);

异常

ArgumentException

如果未设置 options。

Flatten(FlattenFieldsOptions)

在 PDF 文档中展平字段。

public static ResultContainer Flatten(FlattenFieldsOptions options)

参数

返回

ResultContainer :包含操作结果的对象。

示例

此示例演示如何在 PDF 文件中展平字段。

// Create FlattenFieldsOptions object to set instructions
var options = new FlattenFieldsOptions();
// 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 FlattenFieldsOptions object to set instructions
var options = new FlattenFieldsOptions();
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);

异常

ArgumentException

如果未设置 options。

GetNames(GetFieldNamesOptions)

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

public static List<string> GetNames(GetFieldNamesOptions options)

参数

返回

List<string>

PDF 文档中字段名称的列表。

示例

此示例演示如何从 PDF 文件获取字段名称。

// Get Field 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)

参数

返回

ResultContainer :包含操作结果的对象。

示例

此示例演示如何从 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);

异常

ArgumentException

如果未设置 options。

命名空间: Documentize
程序集: Documentize.dll

 中文