PdfFormData Class

The values of the fields of a form, apart from the document: read from and written to FDF (Forms Data Format, ISO 32000-2, 12.7.8) and XFDF (XML Forms Data Format, ISO 19444-1). PdfInteractiveForm.ExportData exports the values of a form, and PdfInteractiveForm.ImportData fills a form with them.

public sealed class PdfFormData

Remarks

Only the values of the fields are read and written: the annotations, the appearances, the JavaScript and the other entries of FDF and XFDF are ignored. The names of the fields are fully qualified (address.city); the files store them as a hierarchy of partial names.

Constructors

NameDescription
PdfFormData()

PdfFormData()

PdfFormData.cs
public PdfFormData()

No documentation is available.

Properties

NameDescription
FieldsGets the values of the fields.
SourceFileGets or sets the file the data belongs to: /F of the FDF dictionary, href of the f element of XFDF.

Gets the values of the fields.

public IList<PdfFormDataField> Fields { get; }

SourceFile

PdfFormData.cs

Gets or sets the file the data belongs to: /F of the FDF dictionary, href of the f element of XFDF.

public string? SourceFile { get; set; }

Property value

string?

Methods

NameDescription
ParseFdf(ReadOnlySpan<byte>, PdfReadOptions?)Reads FDF data (ISO 32000-2, 12.7.8): the /Fields of the FDF dictionary.
ParseXfdf(Stream)Reads XFDF data (ISO 19444-1) from a stream: the field and value elements of the fields element.
ParseXfdf(string)Reads XFDF data (ISO 19444-1): the field and value elements of the fields element.
ToFdf()Writes the data as FDF (ISO 32000-2, 12.7.8): a field hierarchy of partial names in the FDF dictionary.
ToXfdf()Writes the data as XFDF (ISO 19444-1): nested field elements with partial names, and their value elements.

ParseFdf(ReadOnlySpan<byte>, PdfReadOptions?)

PdfFormData.cs

Reads FDF data (ISO 32000-2, 12.7.8): the /Fields of the FDF dictionary.

public static PdfFormData ParseFdf(ReadOnlySpan<byte> data, PdfReadOptions? options = null)

Parameters

data ReadOnlySpan<byte>
The FDF file.
options PdfReadOptions?
The options of the reader, or null for the default options.

Returns

PdfFormData The data.

Exceptions

InvalidPdfContentException
The data is not an FDF file.
PdfException
The file cannot be read.

ParseXfdf overloads

ParseXfdf(Stream)

PdfFormData.cs

Reads XFDF data (ISO 19444-1) from a stream: the field and value elements of the fields element.

public static PdfFormData ParseXfdf(Stream stream)
Parameters
stream Stream
The XFDF document.
Returns

PdfFormData The data.

Exceptions
InvalidPdfContentException
The stream is not an XFDF document.

ParseXfdf(string)

PdfFormData.cs

Reads XFDF data (ISO 19444-1): the field and value elements of the fields element.

public static PdfFormData ParseXfdf(string xml)
Parameters
xml string
The XFDF document.
Returns

PdfFormData The data.

Exceptions
InvalidPdfContentException
The text is not an XFDF document.

Writes the data as FDF (ISO 32000-2, 12.7.8): a field hierarchy of partial names in the FDF dictionary.

public byte[] ToFdf()

Returns

byte[] The FDF file.

Remarks

A name given several times is written once, with its last value.

Writes the data as XFDF (ISO 19444-1): nested field elements with partial names, and their value elements.

public string ToXfdf()

Returns

string The XFDF document.

Remarks

A name given several times is written once, with its last value. The characters that XML cannot hold (control characters, unpaired surrogates) are written as U+FFFD.