ExportFormDataToFDFString
Form fields
Description
Returns the names and current values of the document's form fields as a complete FDF document in a string, or an empty string when the document carries no form data.
Field names and string values use PDF text-string encoding, preserving Unicode characters through UTF-16BE when required; an empty field value is exported explicitly as /V ()
Syntax
Delphi
Function TPDFlib.ExportFormDataToFDFString: AnsiString;
Parameters
The function takes no arguments: it exports the form data of the currently selected document, so a document must be open and it must carry form fields.
Return values
A complete FDF 1.2 document as raw bytes, ready for storage or for ImportFormDataFromFDFString, or an empty AnsiString when no document is open or the document has no form data. The AnsiString result type is deliberate: it keeps the PDF-encoded bytes intact instead of passing them through the Unicode conversion a WideString result would apply.
Remarks
Field names are escaped as PDF name objects and values as PDF literal strings per ISO 32000-1, so parentheses, backslashes and non-printable bytes are escaped and characters outside PDFDocEncoding switch the string to UTF-16BE. Non-terminal parent fields and unnamed fields are skipped to avoid clearing their children on import, buttons export the selected state name with /Off as the empty value, and a multiple-selection choice becomes an array of strings. Because the result is self-contained, it can be cached or stored before the PDF is saved; the PDF is neither saved nor modified.