|
AcroForm Support Overview Since HotPDF v2.5.0 the library can emit interactive forms (AcroForm) per
PDF 1.7 ISO 32000-1 section 12.7. Each form field is created as a Widget
annotation merged with the field dictionary and is automatically registered
with the document so the global Loaded documents can store a terminal field separately from its widget annotations in Supported field types
Generated push-button appearances display valid UTF-8 captions within the 218-character canonical printable WinAnsi profile using standard Helvetica and centre them horizontally using the matching glyph advances before PDF literal escaping, so escaped parentheses, backslashes and high-byte octal escapes do not count as extra glyphs. Existing caption storage, action metadata, vertical placement, font-size selection, left clamp and appearance-generation policy are retained. For multibyte UTF-8 captions, unsupported scalars or malformed sequences retain the whole-caption empty appearance; the original ASCII path is unchanged and general Unicode, automatic font fallback and complex shaping remain outside this finite profile Creation-time field wrappers Since HotPDF v2.292.12, the Since HotPDF v2.292.26, Since HotPDF v2.298.0, creation-time field APIs and loaded-document field-creation APIs reject duplicate root field names with a diagnostic exception before any widget is registered. Repeated The wrapper exposes chainable setters for Creation-time wrapper Pascal example
Loaded form-field inspection and updates Since HotPDF v2.121.9, applications can load an existing AcroForm PDF
with The field helpers are Loaded-field Pascal example
Field additional actions The wrappers Loaded listbox top option When rebuilding a loaded listbox appearance, HotPDF starts the visible option window at the valid The lookup uses the nearest present A missing value starts at option zero, and a present null, invalid, fractional, negative or out-of-range value also falls back to zero for appearance only; the original field data is preserved and combo-box appearance behaviour is unchanged Loaded password appearances When rebuilding a loaded password text field, a valid UTF-16 surrogate pair produces one asterisk, each other BMP character produces one asterisk, and each unmatched surrogate code unit also produces one asterisk This rule changes the generated appearance only; stored Loaded-field nominal font advances For the twelve exact Latin Base14 The metric path uses one positive explicit font size or the supported zero-size request described below, together with the supported default-appearance subset and a font that has no descriptor or explicit Single-line alignment, multiline whole-word wrapping, individual comb-cell centring, combo and listbox display labels, password masks and loaded push-button captions use the same emitted-glyph measurement; literal escapes add no advance, and a substituted character measures the glyph actually selected by its emitted replacement byte Padding, clipping, rotation, field values and resource ownership retain their existing roles; incomplete font overrides, Type0 fonts and operators outside the supported text-state subset retain their previous measurement policy, whilst eligible zero-size requests use the automatic sizing profile below These nominal advances do not add kerning, general Unicode display, complex-script shaping or arbitrary text-state measurement Loaded-field declared simple-font advances Eligible loaded-field appearances use the selected The table is indexed by the bytes the effective encoder actually emits, including replacement and password-mask bytes; direct and indirect arrays, bounds and numeric entries describe the same advances Bytes outside the declared span use the descriptor's The path uses one positive finite font size or the supported zero-size request described below, and applies to alignment, whole-word wrapping, comb cells, choice display labels and loaded push-button captions An invalid table or an unrepresentable measurement retains the previous measurement policy for that complete run; Type0 and Type3 fonts and operators outside the supported text-state subset retain their existing behaviour Declared advances preserve field values, actual font resources and embedded program bytes; they do not add encoding coverage, kerning, general Unicode display or complex-script shaping Long decimal declared-width values on FPC For supported loaded component-field declared-width measurements on FPC, long decimal numeric tokens are converted directly from their complete decimal value to the nearest This avoids the legacy numeric input-length limit and intermediate extended-precision double rounding; finite signed values and signed zero retain their numeric meaning, whilst the original source token and saved numeric bytes are preserved Invalid PDF numeric tokens, overflow and nonzero values that round to zero retain the existing whole-run measurement fallback rather than being accepted as valid zero widths Short-token and Delphi conversion paths retain their previous behaviour; this finite repair does not establish correctly rounded conversion for every numeric token or compiler, broaden supported font profiles or add Type0, CFF, shaping or general dynamic XFA support Loaded-field text-state layout Eligible loaded-field appearances measure finite The finite default-appearance parser accepts one positive explicit Measurement follows the bytes actually emitted after encoding, replacement or omission; Left, centre and right justification, multiline whole-word wrapping, each comb cell, choice labels and loaded captions share the union of the signed glyph advance cells after horizontal scaling; backward or mirrored runs are positioned by their minimum and maximum cell endpoints, including the natural advance cell of a space This interval is a layout measurement, not an ink bounding box; spacing after the final glyph moves the PDF cursor but does not enlarge an independently positioned run, and comb cells use the same rule for each absolute text position Each generated text scope initialises character spacing, word spacing and horizontal scaling before replaying its default appearance, including text scopes reopened for listbox selection highlighting, so caller text state does not leak into the field appearance Eligible zero-size requests use the content-fitting profile below whilst preserving the other admitted default-appearance state These component-field layout rules do not add Type0 metrics, CFF or implicit TrueType built-in encoding providers, arbitrary default-appearance execution, kerning, general Unicode display or complex-script shaping, and do not imply a new Linux headless acceptance result Loaded-field automatic font size Eligible loaded component fields with one Sizing follows the final emitted text after encoding, replacement, omission, password masking or choice display-label selection, using the selected nominal or declared glyph advances with finite Single-line text, each occupied comb cell, combo displays and loaded push-button captions use their existing alignment and baseline contracts; multiline fields keep whole-word wrapping and check the complete wrapped value before painting rather than treating clipped trailing rows as fitted A listbox freezes its visible option window from For an admitted request, only the original The fit uses glyph advance cells and the existing vertical layout cells rather than ink bounds, within the supported measurement and existing geometry-serialisation ranges; when no admitted size fits or a numeric measurement cannot be completed, a clipped preferred-size fallback retains the value, font and other admitted This finite component-field profile does not add Type0 metrics, CFF or implicit TrueType encoding providers, complex shaping, arbitrary default-appearance execution or general dynamic XFA support, and does not imply a new Linux headless acceptance result Automatic-size interval work for ordinary runs Eligible automatic-size runs with zero accumulated spacing offsets, nonnegative natural advances and monotone scaled endpoints use a linear number of interval constraints within a certified finite numeric range The shortcut still validates every emitted byte, glyph advance and required missing-width lookup, and retains the complete final fit check before using a selected size Runs outside that certificate, including negative natural advances, nonzero accumulated spacing offsets or extreme numeric bounds, retain the complete constraint path and its existing numeric fallback behaviour This optimisation applies to interval calculation; the cost of complete wrapping and automatic-sizing searches still depends on the content Loaded-field default-appearance font selection Loaded-field appearance generation reads font selection independently of the finite glyph-measurement profile: space, NUL, tab, linefeed, formfeed and carriage return are valid PDF whitespace, and comments may separate the font name, numeric size and Supported positive size tokens include signed and fractional decimal forms; the generated appearance keeps the original admitted default-appearance bytes, including separators and comments, whilst binding the selected input font resource When the default appearance contains several Font resource names are matched case-sensitively after one PDF name-decoding pass: The original field Correct font binding does not broaden the single-font text-state metric subset: complex default appearances retain their previous glyph-measurement policy, and this repair does not add arbitrary graphics-state execution, Type0 metrics, general Unicode display, complex shaping or general dynamic XFA support Loaded-field font encoding Loaded-field appearances match the AcroForm Loaded-field simple-font encoding Loaded component-field appearances build the effective simple-font encoding before mapping decoded field text to glyph bytes, retaining case-sensitive font resource selection and the original font program For supported Type1 fonts, named WinAnsi, MacRoman and MacExpert encodings and legal explicit The finite nonsymbolic The loaded component-field inverse uses the complete Adobe Glyph List associations and supported suffix, component and strict synthetic-scalar rules; multi-scalar glyph associations stay distinct during scalar lookup and are not reduced to their first scalar, without changing the global glyph-name API or adding shaping When
Effective byte selection, declared advances and eligible Base14 nominal advances share the same final glyph sequence for alignment, comb cells and whole-word wrapping Equivalent byte positions may select the same exact original glyph and advance; visible glyph identity is distinct from an arbitrary canonical-byte choice or a text-extraction map A real mapped question glyph is preferred for replacement, with the documented legacy missing-glyph byte retained only when it does not select a different real glyph The Type1 provider supports its implemented header forms and is not a general PostScript interpreter; CFF and implicit TrueType built-in providers, Type0 changes, arbitrary Unicode display, kerning and complex shaping remain outside this finite delivery Headless font-supplied APIs use separate paths, so these Windows component-field rules do not imply new Linux execution acceptance The full Standard table maps When the selected font reference is absent, HotPDF creates Helvetica and uses its built-in Standard encoding; a damaged non-null font reference is not treated as this controlled fallback The predefined PDF encoding names do not include Unsupported font programs and malformed encoding graphs retain their existing fallback policies; these finite simple-font paths do not add Type0 behaviour, arbitrary Unicode display or shaping
Appearance generation By default HotPDF pre-builds Field flag reference (
Pascal example
Authored text-field UTF-8 appearances and Helvetica advancesNew text fields created through Comb fields centre each encoded character's actual Helvetica advance in its cell, whilst multiline fields use those same advances to keep whole words together when they fit and split oversized words into fitting character spans Ordinary authored multiline fields retain CR, LF and CRLF separators, intervening empty paragraphs and spaces inside each line; tabs advance to the next multiple of eight actual Helvetica space advances without emitting a TAB glyph. Whole-word wrapping may visually omit line-edge whitespace, whilst a character wider than the available line still progresses and uses the existing clip rather than claiming a fit Password appearances use one asterisk per valid Unicode scalar, including characters outside WinAnsi; the original field value, MaxLen, flags and appearance-generation policy remain unchanged The fixed-size path retains its existing viewport, font-size limits, leading and vertical placement; unsupported ordinary text and malformed multibyte input retain the empty-appearance fallback, and this does not add general Unicode fonts, complex shaping or ink-bound measurement HTML textarea values and native multiline appearancesImported textarea controls preserve their normalised literal value in The native UNIX canvas These are separate component and native appearance contracts, with their existing fonts, clips, baselines and leading; this feature description does not imply a new Linux execution or general Unicode font coverage Authored Helvetica zero-size content fittingCreate an ordinary text field with appearance generation on, which is the default and also what This finite profile accepts one exact The field retains the original zero-size Fitting uses the actual Helvetica advances of the emitted WinAnsi bytes and the existing single-line, multiline and occupied comb-cell plans; every planned row and occupied cell must fit, using the em-cell interval from one quarter of the font size below the baseline to three quarters above it inside the existing clip inset The deterministic decreasing search can select sizes below six points or above twelve points when a complete layout fits; it promises a finite content fit, not a globally maximal size or an ink-bound guarantee, and retains the authored baseline and multiline leading rather than adopting the loaded-field layout If no tested size fits, the existing clipped preferred-size appearance remains; unsupported ordinary text retains the existing empty-appearance fallback, and neither fallback is a successful content fit Positive-size requests, rich-text fields and other default-appearance profiles retain their existing setter behaviour; subsequent value updates through Limitations
Native field creation and flag editing preserve exact 32-bit See AcroForm field flag precision for signed mask values, inheritance and native builder behaviour See Also |