Class PdfForm
Represents Documentize.PdfForm component. Used to Flatten, Extract Forms Data. Also allows you to Get Fields Names.
Represents Documentize.PdfForm component. 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)
Extract Form Data from PDF document.
public static ResultContainer Extract(ExtractFormDataToDsvOptions options)Parameters
optionsExtractFormDataToDsvOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Examples
The example demonstrates how to Export Form values to CSV file.
// 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);The example demonstrates how to Export Form values to TSV file and set Properties.
// 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);Exceptions
If options not set.
Flatten(FlattenFieldsOptions)
Flatten fields in PDF document.
public static ResultContainer Flatten(FlattenFieldsOptions options)Parameters
optionsFlattenFieldsOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Examples
The example demonstrates how to Flatten fields in PDF file.
// 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);The example demonstrates how to Flatten fields in PDF file and skip first field.
// 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);Exceptions
If options not set.
GetNames(GetFieldNamesOptions)
Retrieves the names of all interactive form fields in a PDF document.
public static List<string> GetNames(GetFieldNamesOptions options)Parameters
optionsGetFieldNamesOptions: An instance of Documentize.GetFieldNamesOptions that specifies the input source: (file path or stream) and instructions for the operation.
Returns
A list of strings representing the field names found in the PDF document.
Examples
The example demonstrates how to get field names from a PDF file in the shortest possible style.
// Get field names
var fieldNames = PdfForm.GetNames(new GetFieldNamesOptions("path_to_your_pdf_file.pdf"));The example demonstrates how to get field names from a PDF file.
// Create GetFieldNamesOptions object to set instructions
var options = new GetFieldNamesOptions("path_to_your_pdf_file.pdf");
// Perform the process and get names
var fieldNames = PdfForm.GetNames(options);The example demonstrates how to get field names from a PDF stream.
// Prepare input stream
using var inputStream = File.OpenRead("path_to_your_pdf_file.pdf");
// Get field names
var fieldNames = PdfForm.GetNames(new GetFieldNamesOptions(inputStream));The example demonstrates how to set Input property of the Documentize.GetFieldNamesOptions class. This can be useful in loop operations, without creating a new instance.
var options = new GetFieldNamesOptions();
// Set input from a file
options.Input = new FileData("path_to_your_pdf_file.pdf");
// Or set input from a stream
// options.Input = new StreamData(stream);
var results = PdfForm.GetNames(options);Remove(RemoveFieldsOptions) : Remove Fields from PDF document.
public static ResultContainer Remove(RemoveFieldsOptions options)Parameters
optionsRemoveFieldsOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Examples
The example demonstrates how to Remove fields from PDF file.
// 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);Exceptions
If options not set.
Namespace: Documentize Assembly: Documentize.dll