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 preserved and do not count as changes
The loaded document retains all original and previously prepared values, fonts and appearances; the output incorporates those prepared changes 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 raises 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 preserved
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 discard the complete candidate operation
The source file cannot be the destination, including physical aliases; output paths must be nonempty and contain no NUL
The complete decoded model is validated before staging; any subsequent failure, cancellation or budget exhaustion preserves an existing destination and removes unpublished private files
The private encrypted graph must retain the exact authenticated source encryption dictionary before borrowing its revision key; passwords are not retained or 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