THPDFHeadlessDocument.ImportFormDataToFile
function ImportFormDataToFile(const FileName: string;
const Bytes: SysUtils.TBytes; Format: THPDFHeadlessFormDataFormat;
const TrueTypeFont: SysUtils.TBytes;
const AppearanceOptions: THPDFHeadlessTextAppearanceOptions;
const Options: THPDFHeadlessFormDataOptions): Integer;
Decodes all supplied form-data bytes, applies actual changed values and regenerated widget appearances to a private revision graph and atomically publishes an independent incremental PDF
The return value counts changed terminal fields, including a radio group as one field; unchanged values are left alone and do not count as changes
The loaded document retains all original and previously prepared values, fonts and appearances; the output folds those prepared changes in before applying the imported values
Name-only entries leave fields untouched, including signatures; a supplied value for an unknown field or unsupported signature or pushbutton field produces a typed diagnostic
Text fields require one text value, choice fields accept scalar text or arrays, and buttons require a scalar export state; existing checkbox and radio export states are kept
TrueTypeFont must contain all required text and button glyphs; AppearanceOptions controls real layout, shaping, spacing and widget appearances through the existing native appearance setters
This entry supplies the regular rich font slot only; use ImportRichFormDataToFile to provide genuine bold, italic and bold-italic programs for imported rich values
Read-only flags, required field constraints, authenticated DocMDP and FieldMDP, prior signature integrity and AES form-fill permissions are enforced before publication
Unchanged read-only values permit an idempotent round trip; changed read-only or locked values throw away the complete candidate operation
The source file cannot be the destination, including physical aliases; output paths must be non-empty and contain no NUL
The complete decoded model is validated before staging; any subsequent failure, cancellation or budget exhaustion keeps an existing destination and removes unpublished private files
The private encrypted graph must hold the exact authenticated source encryption dictionary before its revision key can be borrowed; passwords are neither retained nor replayed
Tokens must match the loaded document when non-nil; form-data and document limits bound parsing, field counts, nesting, text, generated appearances and complete PDF output