HPDFXFABuildChoiceFieldAppearance
Unit: HPDFXFAHeadless
function HPDFXFABuildChoiceFieldAppearance(const Kind, Value, Style: AnsiString;
const Items: TXFAFieldOptions; Width, Height: Double;
const TrueTypeFont: SysUtils.TBytes; FirstObjectNumber: Integer;
const Options: TXFAHeadlessPDFOptions;
GenerateAppearance: Boolean = True): THPDFXFAChoiceAppearance;
Prepares one native combo or list choice field without changing a caller document or output stream, using the same option, selection, scrolling and appearance consumer as automatic headless XFA creation
Kind is combo or list; Value and Items contain UTF-8 text, Width and Height are physical PDF points, and Style contains the metadata emitted by the XFA layout callback
The exact export and display arrays and raw selection in Style take precedence over the compatibility Items and Value arguments, preserving authored whitespace and separate display labels
The returned bundle contains V, Opt, I when selected, TI for lists, Ff and Q, plus AP and DA when requested; it excludes field identity, page identity, parent and rectangle
Multi-select lists store a real PDF value array and selected indices in option order; editable combos retain free text without inventing an option index
TrueTypeFont supplies the actual font program for generated appearances; a list scrolls to show selected options using actual font metrics and paints selected rows with their display labels
GenerateAppearance defaults to True; False prepares metadata only, requires no font program, creates no AP or DA and performs no glyph work; a metadata-only list starts at its first selected index because viewer metrics determine its eventual viewport
FirstObjectNumber must be positive and leave room for all consecutive generated object numbers; the caller reserves that range, adopts the objects and registers Fonts in its AcroForm DR before attaching Properties to an actual widget
The bundle owns all objects until detached, and input, object, font, glyph, serialised-byte and cancellation limits in Options apply throughout preparation
For the Windows THotPDF consumer, see legacy XFA choice fields