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 PdfFormDataRemarks
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
| Name | Description |
|---|---|
| PdfFormData() |
PdfFormData()
PdfFormData.cspublic PdfFormData()No documentation is available.
Properties
| Name | Description |
|---|---|
| Fields | Gets the values of the fields. |
| SourceFile | Gets or sets the file the data belongs to: /F of the FDF dictionary, href of the f element of XFDF. |
Fields
PdfFormData.csSourceFile
PdfFormData.csMethods
| Name | Description |
|---|---|
| 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.csReads 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
dataReadOnlySpan<byte>- The FDF file.
optionsPdfReadOptions?- The options of the reader, or
nullfor 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.csReads XFDF data (ISO 19444-1) from a stream: the field and value elements of the fields element.
public static PdfFormData ParseXfdf(Stream stream)Parameters
streamStream- The XFDF document.
Returns
PdfFormData The data.
Exceptions
InvalidPdfContentException- The stream is not an XFDF document.
ParseXfdf(string)
PdfFormData.csReads XFDF data (ISO 19444-1): the field and value elements of the fields element.
public static PdfFormData ParseXfdf(string xml)Parameters
xmlstring- The XFDF document.
Returns
PdfFormData The data.
Exceptions
InvalidPdfContentException- The text is not an XFDF document.
ToFdf()
PdfFormData.csWrites 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.
ToXfdf()
PdfFormData.csWrites 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.