THotPDF.ImportLoadedFormFromXFDF Method
Imports form field values from an XML Forms Data Format (XFDF) file into the loaded document
The import is atomic across all fields: a rejected later update rolls back earlier values and generated appearances, while a successful import preserves any caller-owned enclosing graph transaction
Multiple value elements populate a multi-select choice field without joining or splitting text on line breaks; supported selections rebuild the field value and selection indices without modifying ancestor defaults or sibling fields
A field element without a value leaves the existing field unchanged; one empty value clears a multi-select field with no empty export option, or selects that option when it exists
Array values are validated before changing their target field; request appearance regeneration explicitly before saving when visible text or choice appearances must change
Exact option values take priority across the complete imported selection list, regardless of option order; only unmatched XFDF text can use the compatibility fallback for hexadecimal spellings, and a successful fallback stores the actual matched option value
The low-level HPDFXFDFImportFields overload accepts a separate, initialized THPDFXFDFArrayAccess record; its setter returns true after handling the complete value list, otherwise a single value falls back to the scalar setter and multiple values are rejected
The original low-level overload retains its legacy behavior for existing integrations, including joining multiple values with LF; THotPDF uses the new array-aware overload
Syntax
function ImportLoadedFormFromXFDF(const AFileName: TFileName): Integer;
Parameters
- AFileName: TFileName
- The file name of the XFDF data to import
Return Value
Returns the number of fields updated; a missing file returns zero, while file I/O and rejected field updates can raise exceptions