procedure GenerateFormAppearances;
GenerateFormAppearances uses the native form-fill editor to rebuild editable text and combo-box appearances, and synchronises checkbox and radio-button appearance states
Native text and combo-box assignments commit appearances through the form-fill editor; raw dictionary changes or initially absent appearances may still need regeneration before flattening, which relies on stored appearance streams rather than the live editor display
The correct workflow when filling and locking a form is: assign all FormField[] values → call GenerateFormAppearances once → optionally call FlattenPage / FlattenAllPages → call SaveAs. If you only need to save the filled form without flattening, GenerateFormAppearances is still recommended to ensure maximum compatibility with third-party PDF viewers
The procedure operates on the entire document in one call; there is no per-page variant
begin
// Assign form field values
Pdf1.FormField[0] := 'Alice Example';
Pdf1.FormField[1] := '[email protected]';
Pdf1.FormField[2] := '2026-05-20';
// Bake appearance streams so values are visible in all viewers
Pdf1.GenerateFormAppearances;
// Flatten and save a non-editable copy
Pdf1.FlattenAllPages;
Pdf1.SaveAs('output_filled_flat.pdf');
end;
For inherited widgets, a temporary native edit is followed by checked restoration of the original parent-field value; the widget receives no shadow value
Inherited read-only fields raise an error because this editing route cannot be used; GenerateFormAppearances does not provide a document transaction