Interface IPdfFormService
Reads, fills, exports, imports, resets and flattens interactive form fields (AcroForm).
public interface IPdfFormService
Methods
ExportFormDataXfdfAsync(IPdfDocument, string, CancellationToken)
Writes the field values to an XFDF file.
ValueTask ExportFormDataXfdfAsync(IPdfDocument document, string targetXfdfPath, CancellationToken cancellationToken = default)
Parameters
documentIPdfDocumentAn open document of this engine.
targetXfdfPathstringThe XFDF file to write.
cancellationTokenCancellationTokenCancels the operation.
Returns
FlattenFormFieldsAsync(IPdfDocument, string, CancellationToken)
Writes a copy of the document with the fields drawn into the page content, so that they are no longer editable.
ValueTask FlattenFormFieldsAsync(IPdfDocument document, string targetPath, CancellationToken cancellationToken = default)
Parameters
documentIPdfDocumentAn open document of this engine.
targetPathstringThe file to write.
cancellationTokenCancellationTokenCancels the operation.
Returns
GetFormFieldsAsync(IPdfDocument, int, CancellationToken)
Gets the form fields that have a widget on a page.
ValueTask<IReadOnlyList<FormFieldModel>> GetFormFieldsAsync(IPdfDocument document, int pageNumber, CancellationToken cancellationToken = default)
Parameters
documentIPdfDocumentAn open document of this engine.
pageNumberintThe page number, starting at 1.
cancellationTokenCancellationTokenCancels the operation.
Returns
ImportFormDataXfdfAsync(IPdfDocument, string, CancellationToken)
Reads field values from an XFDF file into the open document.
ValueTask ImportFormDataXfdfAsync(IPdfDocument document, string sourceXfdfPath, CancellationToken cancellationToken = default)
Parameters
documentIPdfDocumentAn open document of this engine.
sourceXfdfPathstringThe XFDF file to read.
cancellationTokenCancellationTokenCancels the operation.
Returns
ResetFormAsync(IPdfDocument, CancellationToken)
Sets every field back to its default value.
ValueTask ResetFormAsync(IPdfDocument document, CancellationToken cancellationToken = default)
Parameters
documentIPdfDocumentAn open document of this engine.
cancellationTokenCancellationTokenCancels the operation.
Returns
SetFieldValueAsync(IPdfDocument, string, string, CancellationToken)
Sets the value of a field in the open document.
ValueTask SetFieldValueAsync(IPdfDocument document, string fieldName, string value, CancellationToken cancellationToken = default)
Parameters
documentIPdfDocumentAn open document of this engine.
fieldNamestringThe fully qualified field name.
valuestringThe new value.
cancellationTokenCancellationTokenCancels the operation.