Class PdfForm
信息
表示 Documentize.PdfForm 组件。用于扁平化、提取表单数据。还可以让您获取字段名称。
表示 Documentize.PdfForm 组件。用于扁平化、提取表单数据。
还可以让您获取字段名称。
public static class PdfForm继承
继承的成员
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object?)
- object.Equals(object?, object?)
- object.ReferenceEquals(object?, object?)
- object.GetHashCode()
方法
Extract(ExtractFormDataToDsvOptions)
从 PDF 文档中提取表单数据。
public static ResultContainer Extract(ExtractFormDataToDsvOptions options)参数
optionsExtractFormDataToDsvOptions: 包含操作指令的选项对象。
返回
ResultContainer : 包含操作结果的对象。
示例
该示例演示如何将表单值导出为 CSV 文件。
// Create ExtractFormDataToDsvOptions object to set instructions
var options = new ExtractFormDataToDsvOptions(',', true);
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_csv_file.csv"));
// Perform the process
PdfForm.Extract(options);该示例演示如何将表单值导出为 TSV 文件并设置属性。
// Create ExtractFormDataToDsvOptions object to set instructions
var options = new ExtractFormDataToDsvOptions();
//Set Delimiter
options.Delimiter = '\t';
//Add Field Names to result
options.AddFieldName = true;
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_csv_file.tsv"));
// Perform the process
PdfForm.Extract(options);异常
如果未设置 options。
Flatten(FlattenFieldsOptions)
在 PDF 文档中扁平化字段。
public static ResultContainer Flatten(FlattenFieldsOptions options)参数
optionsFlattenFieldsOptions: 包含操作指令的选项对象。
返回
ResultContainer : 包含操作结果的对象。
示例
该示例演示如何在 PDF 文件中扁平化字段。
// Create FlattenFieldsOptions object to set instructions
var options = new FlattenFieldsOptions();
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Perform the process
PdfForm.Flatten(options);该示例演示如何在 PDF 文件中扁平化字段并跳过第一个字段。
// Get Fields Names
var fieldNames = PdfForm.GetNames(new GetFieldNamesOptions("path_to_your_pdf_file.pdf"));
// Create FlattenFieldsOptions object to set instructions
var options = new FlattenFieldsOptions();
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Skip 1 field.
options.SkipFields.Add(fieldNames[0]);
// Perform the process
PdfForm.Flatten(options);异常
如果未设置 options。
GetNames(GetFieldNamesOptions)
获取 PDF 文档中的字段名称。
public static List<string> GetNames(GetFieldNamesOptions options)参数
optionsGetFieldNamesOptions: 包含操作指令的选项对象。
返回
PDF 文档中名称的列表。
示例
该示例演示如何从 PDF 文件获取字段名称。
// Get Field Names
var fieldNames = PdfForm.GetNames(new GetFieldNamesOptions("path_to_your_pdf_file.pdf"));Remove(RemoveFieldsOptions) : 从 PDF 文档中删除字段。
public static ResultContainer Remove(RemoveFieldsOptions options)参数
optionsRemoveFieldsOptions: 包含操作指令的选项对象。
返回
ResultContainer : 包含操作结果的对象。
示例
该示例演示如何从 PDF 文件中删除字段。
// Create RemoveFieldsOptions object to set instructions
var options = new RemoveFieldsOptions();
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Perform the process
PdfForm.Remove(options);异常
如果未设置 options。
Namespace: Documentize
Assembly: Documentize.dll