Table of Contents

Interface IPdfFormService

Namespace
PdfEngine.Forms
Assembly
PdfEngine.Abstractions.dll

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

document IPdfDocument

An open document of this engine.

targetXfdfPath string

The XFDF file to write.

cancellationToken CancellationToken

Cancels the operation.

Returns

ValueTask

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

document IPdfDocument

An open document of this engine.

targetPath string

The file to write.

cancellationToken CancellationToken

Cancels the operation.

Returns

ValueTask

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

document IPdfDocument

An open document of this engine.

pageNumber int

The page number, starting at 1.

cancellationToken CancellationToken

Cancels the operation.

Returns

ValueTask<IReadOnlyList<FormFieldModel>>

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

document IPdfDocument

An open document of this engine.

sourceXfdfPath string

The XFDF file to read.

cancellationToken CancellationToken

Cancels the operation.

Returns

ValueTask

ResetFormAsync(IPdfDocument, CancellationToken)

Sets every field back to its default value.

ValueTask ResetFormAsync(IPdfDocument document, CancellationToken cancellationToken = default)

Parameters

document IPdfDocument

An open document of this engine.

cancellationToken CancellationToken

Cancels the operation.

Returns

ValueTask

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

document IPdfDocument

An open document of this engine.

fieldName string

The fully qualified field name.

value string

The new value.

cancellationToken CancellationToken

Cancels the operation.

Returns

ValueTask