PdfFormField

One terminal interactive-form field (ISO 32000-1 §12.7.3), flattened from the AcroForm field tree with inheritable attributes (/FT, /DA, /Ff, /V, /Q) resolved down from ancestors.

A field and its single widget annotation are frequently merged into one dictionary; when they are separate (e.g. one logical field with widgets on several pages) fieldReference and widgetReference differ. The writer's form-fill uses these references plus rect (the widget's /Rect) to set the value and regenerate the appearance.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
Link copied to clipboard
class Widget

One place a field is drawn: its annotation, its rectangle, and the reference to reach it.

Properties

Link copied to clipboard

The scripts of the field's first widget, or of the field itself when the two are merged. Each button of a radio group has scripts of its own: read those from widgets.

Link copied to clipboard

The original /Opt indices, exports and labels (ISO 32000-1, 12.7.4.4).

Link copied to clipboard

Height of one displayed choice row in PDF points, using /DA (ISO 32000-1, 12.7.3.3).

Link copied to clipboard

The complete source /V, with /I resolving duplicate exports when consistent.

Link copied to clipboard

/Ff bit 27 commits a selection change immediately (ISO 32000-1, Table 230).

Link copied to clipboard

Variable-text default appearance string (/DA), inherited if absent.

Link copied to clipboard

The complete reset value /DV, or an empty selection (ISO 32000-1, 12.7.3.1).

Link copied to clipboard

The value the field goes back to when the form is reset (/DV), or null when it has none.

Link copied to clipboard

Indirect reference to the field dictionary, for editing.

Link copied to clipboard
val flags: Int

Field flags (/Ff), inherited if absent.

Link copied to clipboard

Fully-qualified name: ancestor partial names joined by '.'.

Link copied to clipboard

/Ff bit 18: a combo rather than a list (ISO 32000-1, Table 230).

Link copied to clipboard

/Ff bit 19 is meaningful only for a combo (ISO 32000-1, Table 230).

Link copied to clipboard

/Ff bit 13 (text fields): multi-line.

Link copied to clipboard

/Ff bit 22 allows several selected list options (ISO 32000-1, Table 230).

Link copied to clipboard

/Ff bit 1: the field is read-only.

Link copied to clipboard

/Ff bit 26 (text fields): the value is rich text, XHTML kept in /RV next to the plain value in value (ISO 32000-1, 12.7.3.4).

Link copied to clipboard

How many characters a text field takes (/MaxLen), or null when it does not say.

Link copied to clipboard

The choices of a list box or a combo box, in the order the file lists them (/Opt, ISO 32000-1 §12.7.4.4). This legacy label view omits malformed entries; use choiceOptions to retain original option indices and export values.

Link copied to clipboard

This field's own /T, or null for an anonymous node.

Link copied to clipboard

Quadding for variable text (/Q): 0 left, 1 centre, 2 right.

Link copied to clipboard

The first widget's /Rect, or null when this terminal field has no widget.

Link copied to clipboard

The text a viewer shows when the pointer rests on the field (/TU), or null.

Link copied to clipboard

Original option index at the top of a list, /TI, clamped to a non-negative value.

Link copied to clipboard
Link copied to clipboard

/V as text; for choices, the first selected export value. Use choiceSelection for all values.

Link copied to clipboard

Indirect reference to the widget annotation (== fieldReference when merged).

Link copied to clipboard

Every widget annotation this field owns, in the order the field declares them. One field may be shown in several places: a radio group has one widget per button, and a field may repeat on several pages (ISO 32000-1 §12.7.3.1). The first entry is the one rect, widgetReference and widgetDict describe.

Functions

Link copied to clipboard
fun choiceContentPadding(widgetIndex: Int = 0): Double

Content inset of a choice widget in PDF points, accounting for its own border.

Link copied to clipboard

Adapts a scalar export value to one option, choosing the first duplicate export. Empty text clears a noneditable field only when it has no empty export option. Other unmatched values are valid only for an editable combo (ISO 32000-1, 12.7.4.4).

Link copied to clipboard
fun choiceTopIndexFor(selection: PdfChoiceSelection, visibleRows: Int): Int

Original option index at the top of the displayed list. Starts at /TI and moves to the first selected row if no selected row is visible, so drawing and pointer hit tests use the same viewport. Returns zero when no usable options remain.

Link copied to clipboard

Export values in option order, followed by unresolved source strings; text stays scalar.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Validates a new selection and sorts its indices in original option order. Duplicate, unavailable or disallowed indices, mixed text/indices and unresolved source values are refused with null. An empty selection is valid (ISO 32000-1, 12.7.4.4).