Expand description
AcroForm interactive-form support (PDF 32000-1 §12.7).
Two responsibilities:
-
Field model (
AcroForm) — walks/Root /AcroForm /Fields, resolving the field tree into terminalFormFields with fully-qualified names and inherited attributes (/FT/V/DA/Ff/Q). Each terminal field records its widget-annotation object ids, so a consumer can map a page widget back to the field that owns it. -
Appearance generation (
generate_widget_appearance) — for text and choice fields whose producer left no appearance stream (or set/NeedAppearances), synthesizes a form XObject that draws the field value, honoring the/DAfont/size/color,/Qjustification, and the multiline / comb flags. The result feeds the interpreter’s annotation painter exactly like a real/AP /Nstream.
Buttons (checkbox/radio) keep their producer-supplied /AP states; only the
/AS selection is hardened (see the annotation module). Signatures are
modelled but never generate an appearance.
Structs§
- Acro
Form - The document’s interactive form.
- Form
Field - A terminal interactive-form field.
- Generated
Appearance - A synthesized appearance stream for a widget the producer left without one
(or that
/NeedAppearancesasks the viewer to regenerate). Mirrors a form XObject: a/BBox,/Matrix,/Resourcesand a content byte stream.
Enums§
- Field
Kind - The four AcroForm field types (
/FT), plus anUnknowncatch-all. - Field
Value - A resolved field value (
/V).
Constants§
- FF_COMB
- Tx (bit 25): comb formatting —
/MaxLenequally-spaced cells. - FF_
COMBO - Ch (bit 18): combo box (vs. list box).
- FF_
MULTILINE - Tx (bit 13): the text field holds multiple lines.
- FF_
PASSWORD - Tx (bit 14): the value is a password — never rendered.
- FF_
PUSHBUTTON - Btn (bit 17): push button (no persistent value).
- FF_
RADIO - Btn (bit 16): radio button (mutually-exclusive set).
- FF_
READONLY - Common: field is read-only.
Functions§
- generate_
widget_ appearance - Build a generated appearance for a widget, or
Nonewhen nothing should be drawn (button/signature fields, empty/absent values, password fields, or a degenerate rectangle).dr_fontsis the AcroForm/DR /Fontdictionary, used to resolve the/DAfont name to a concrete font object.