Native annotation fallback

Static recovery also runs when an /AP dictionary has a missing or null /N, or when a valid /AS name selects a missing or null normal state. Rollover and down appearances remain separate from the normal appearance

HPDFRenderHeadlessPagePNG constructs temporary appearances for supported annotations without a normal appearance

Existing normal appearances take precedence; active malformed appearances still fail explicitly

The source document remains unchanged: generated streams and fonts belong to the render operation and are released after use

Geometry and static content

Fallback covers Link borders, Square, Circle, Line, Polygon, PolyLine, Ink, Highlight, Underline, StrikeOut, Squiggly, FreeText, Text, Caret, Stamp, FileAttachment, Sound, Redact preview outlines, single-line, multiline, password, default-style comb and rich-text Widget values, checkbox, radio-button or pushbutton Widget borders, marks, captions and normal icons, combo-box Widget captions and list-box Widget rows with their selection highlights

Line geometry includes ten line-ending styles and leader lines; supported borders include solid, dashed and underline styles, plus shaded beveled and inset rectangular borders, with explicit empty color arrays preserving transparency

Popup, Projection and Screen have no standalone painted content without a normal appearance; activated 3D environments, audio, attachments and link actions are outside static raster rendering

Visibility and optional-content checks happen before fallback construction; temporary appearances retain page clipping and the existing view/print, NoZoom and NoRotate geometry rules

Line captions and relief borders

Line captions consume Cap, CP, CO, Contents, RC and DS through the same temporary Unicode text Form path, with measured Inline gaps, Top placement and endpoint-relative offsets

Long captions use above-line placement; explicit paragraph breaks are preserved, and empty plain or rich text leaves the ordinary line intact

Caption bounds retain both the temporary Form BBox and annotation rectangle; ordinary page-content clipping is unchanged

Rectangular beveled and inset borders use opposing light and dark bands with independent border and interior opacity; zero width and empty color arrays retain their transparency semantics

Dashed borders on rectangular widgets and radio buttons leave the background visible between dashes and fill the widget through the outer edge

A legacy /Border array uses its optional fourth entry as the dash pattern. An omitted or null fourth entry uses a solid border, and a present /BS dictionary takes precedence

An omitted or null /Path uses /Vertices for polygon and polyline annotations, including cloudy polygons, and /InkList for ink annotations

Unknown named border styles use the solid default, while non-name styles remain malformed input

Stamp fallback uses Draft when /Name is omitted or null. An explicit stamp name is used as the label

See annotation decorations for the color policy, font lifetime and independent acceptance coverage

FreeText

Plain text supports PDFDocEncoding, UTF-16 and BOM-prefixed UTF-8; XHTML rich text supports inherited default styling and text-stream RC entries

The bounded FreeText default-appearance profile supports Tf, g, rg, k, Tc, Tw, Tz, Ts, TL, one Tm, Tr and stroke state G, RG, K, w, J, j, M and d; zero Tf font size requests transformed automatic fitting

Embedded default TrueType fonts use document font bytes; original Type1C, CIDFontType0C and bare Type1 resources, complete OpenType CFF input and OpenType CFF2 default instances use their documented original-font paths; supported standard fonts and rich-text families use the local platform resolver

Optional font entries whose values resolve to null use omitted-entry behavior. A null FontFile2 entry allows the renderer and the field appearance generator to use a valid FontFile3 program

Temporary text appearances use the read-only rich family builder or read-only plain family builder, including Preview/Print-only TrueType outline fonts; full font bytes and permission flags are preserved, while existing editing builders retain their original admission

DA font names resolve through the annotation's own /DR/Font dictionary before falling back to Catalog AcroForm.DR.Font and page resources; page resources and recognized standard aliases are recovery paths when the default binding is absent

Text layout supports alignment, quarter-turn rotation, rectangle differences and callout geometry; generated font resources remain isolated from existing resources and encrypted source streams

Widget rotation

Version 2.1204.78 honors the widget's own /MK /R when synthesizing a missing normal appearance for text, checkbox, radio, pushbutton, combo-box and list-box widgets

The integer angle is counterclockwise relative to the page and must be a multiple of 90 degrees; negative and larger equivalent angles are normalized, while absent or null rotation uses zero

Quarter turns exchange the logical layout width and height before fitting text, icons and visible list rows, then rotate the complete generated appearance into the original annotation rectangle; captions, selection highlights and button geometry share the same transform

Zero and full-turn settings retain existing output, and an existing embedded normal appearance stays authoritative without an additional widget rotation

Malformed rotation reports a concrete diagnostic before destination output is published; source widget dictionaries and appearance resources remain unchanged

Text-field widgets

A widget annotation whose own or inherited /FT is Tx and which carries no normal appearance is drawn from its own or inherited /V, /DA and /Q inside /Rect, through the same temporary Unicode text Form the FreeText and Stamp paths use

Field entries /FT, /Ff, /V, /MaxLen and /RV resolve on the widget dictionary first and then walk ancestor field dictionaries along /Parent with cycle detection and depth-budget enforcement; /DA, /Q and /DR/Font entries additionally fall back to the catalog /AcroForm dictionary per ISO 32000-1 §12.7.3.1 and §12.7.3.3

A hexadecimal /V or /DA is decoded to its bytes before layout, so UTF-16 text stored that way draws its characters rather than its hex digits; the byte form then keeps the PDFDocEncoding and UTF-16 decoding the FreeText path performs

Version 2.1205.3 also draws multiline values with explicit line breaks and bounded wrapping, password values as one asterisk per validated Unicode scalar, and rich text from string or stream /RV with inherited /DS default styling

Rich XML streams use their Unicode byte-order mark when present and otherwise default to UTF-8; a missing or null plain /V is allowed, including rich-only fields and empty values

Password values are masked before shaping and text-resource construction; rich content cannot override the mask, and the field's actual value is left unchanged

/MaxLen constrains entered data rather than truncating an already stored value during appearance recovery; a comb field additionally uses its positive inherited MaxLen as the number of equal text cells

Version 2.1205.4 draws default-style comb values with left, center or right alignment, fixed or automatic font size, the existing Unicode shaping/fallback planner, original raw-font cell positioning and widget quarter turns

Comb requires MaxLen and clear Multiline, Password and FileSelect flags; its fixed cell grid also supports DoNotScroll, version 2.1206.5 adds styled OpenType rich-comb appearance recovery, and version 2.1207.0 extends rich-comb recovery to mix original embedded Type1 and CFF runs with styled OpenType runs in one shared bidi grid

Version 2.1205.5 draws stored FileSelect pathnames and non-comb DoNotScroll values through the same static text-field appearance path, preserving the stored value and inherited font, alignment and quarter-turn settings

Null widget entries allow inherited field settings and values to apply. An explicit empty text value still clears the field

Recovered text fields, combo boxes and list boxes paint explicit /MK /BC and /MK /BG colors as a vector border and background before drawing the text

For rectangular widgets, an underline border style (/BS /S /U) strokes the bottom edge and paints the background independently of that stroke

Beveled and inset borders on rectangular widgets use lighter and darker vector bands derived from the border color, with the shading reversed for the inset style

An unsigned signature widget with no normal appearance renders an empty vector frame using its border, background and widget rotation. An existing normal appearance still takes precedence

Static FileSelect display does not read or submit the named file, and static DoNotScroll display does not implement an interactive input-capacity policy; non-string non-null plain values, malformed rich values and unsupported field types retain their existing diagnostics

The same generated Forms can be retained by vector-preserving page import, including authenticated AES-256 sources; text remains searchable after releasing the source, while password appearance extraction contains only masks

/MK border or background styling is not consulted, so a field whose box styling comes from it renders without those contributions; /AA actions are ignored because a static raster has no interaction

When Multiline is clear, text stays on one logical line and is vertically centered inside the field: a positive default font size retains its size and clips overflow, while zero requests automatic fitting to the available dimensions

Multiline fields retain explicit line breaks and wrapping; rich text retains the rich family planner and its declared run styles rather than flattening to the plain value

Font resolution checks the widget's own /DR/Font dictionary and inherited /Parent /DR/Font dictionaries before falling back to Catalog AcroForm.DR.Font and page resources, and a name that reaches neither an embedded OpenType font nor a recognized standard alias stays malformed input

A widget contributes no markup geometry of its own, so its generated text appearance is placed without the quadrilateral or callout construction the other subtypes use

Independent acceptance coverage for this slice, including MuPDF and Poppler raster agreement on both DCC64 Win64 and FPC Linux, is recorded in Tests/Rendering/WidgetAppearanceResources

Button widgets

For a button with an existing normal appearance dictionary and no explicit /AS, native rendering and page import use the inherited /V when it names an appearance in that widget. A missing or null entry falls back to the widget's /Off appearance when available

A widget annotation whose own or inherited /FT is Btn and which carries no normal appearance is drawn as a border with an optional mark or caption, so a form built without /AP streams still shows its toggle and pushbutton controls on a rendered page

The border shape follows the radio flag: field flag bit 16 of Table 226 draws a circle, and a checkbox draws a rectangle whose corner radii come from the widget /Border array, inset from /Rect by the border width

The border colour is the widget /MK /BC entry when present and otherwise the annotation /C colour, and the interior is the /MK /BG entry when present; an explicit empty colour array keeps its transparency, so a borderless or unfilled control draws nothing for that part

The widget's explicit /AS takes precedence. When it is absent or null, radio and checkbox groups with /Opt use the inherited /V state as a zero-based position in /Kids. Repeated export labels do not select extra widgets. Without /Opt, a nonempty state other than Off selects the mark

An on state draws its mark inside the border, a stroked tick for a checkbox and a filled dot for a radio button whose colour follows the border, while an off state leaves the border empty, so a rendered page distinguishes a checked control from an unchecked one

A pushbutton, whose field flag bit 17 of Table 226 is set, draws the same rectangular border plus its caption: the /MK /CA text laid out through the temporary Unicode text Form and centred inside the border, with an absent or empty caption leaving just the border

The caption font, size and colour follow the widget /DA when it names a positive size, and otherwise fall back to a fitting size derived from the button height and capped at 12 points, since the caption layout performs no automatic fitting; the caption ignores /Q and /Rotate because it is placed by centre rather than by alignment

A pushbutton can draw the indirect Form XObject supplied by /MK /I as its normal icon, including the Form's bounding box, transformation matrix and original resources

The /MK /TP position controls the icon and caption together

TPNormal appearance
0 or absentCaption only, preserving the existing default
1Icon only
2Caption below the icon
3Caption above the icon
4Caption to the right of the icon
5Caption to the left of the icon
6Caption over the icon

The optional /MK /IF dictionary controls fitting: /SW selects always, bigger-only, smaller-only or never scaling through A, B, S or N; /S selects proportional P or stretched A scaling; /A aligns the icon with two fractions between zero and one, and /FB true uses the full button bounds instead of reserving border width

The icon is clipped to its allocated area and its original indirect resource remains owned by the source document, so repeated rendering does not consume or detach it

Static rendering uses the normal /I icon; rollover /RI, pressed /IX and /AA actions require interaction, while widget /MK /R rotates the synthesized normal icon and caption together

The existing caption-only, checkbox and radio coverage is recorded in Tests/Delphi/ButtonWidgetAppearanceChecks.dpr; direct Linux FPC 3.3.1 icon pixel checks, transformed fitting, repeated resource use, side-by-side caption placement, unchanged default pixels and invalid-alignment output preservation are recorded in Tests/Headless/PushbuttonIcon/Readme.en-us.md

Choice-field widgets

On Unix builds with Fontconfig, plain generated annotation text, including text widgets, FreeText, and choice captions, can use an installed TrueType fallback face when the primary font lacks a complete grapheme. The renderer keeps the primary face for graphemes it covers. Generated forms retain the chosen fonts when flattened through native page import

Generated rich text widget and FreeText appearances also use Fontconfig fallback for uncovered graphemes. A grapheme can span styled runs, and the fallback supplies the required style faces while retaining the authored colors. Font discovery and embedding remain subject to the appearance and page-import budgets

For a grapheme that crosses styles, each fallback face needs to cover only the characters drawn in its style. Fontconfig candidates are checked for that coverage before a face is loaded

Fontconfig matches may select a standalone TrueType font or a TrueType face from an installed collection. Each selected collection member is extracted separately, and repeated matches for the same face within an annotation share its loaded bytes and fallback inspection budget. The first load and the generated appearance resources still count against the applicable limits

Generated choice and pushbutton appearances use the last font selection in /DA, including when operands and operators are separated by tabs, line breaks or PDF comments. A zero font size uses the height-based default while retaining the selected font and color. The list box also uses that effective size to determine how many rows to lay out

Choice fallback appearances decode /V and /Opt as PDF text strings. PDFDocEncoding, UTF-16 and BOM-prefixed UTF-8 can be mixed in the same field. Selections match the decoded export text, so equivalent strings select the same option across encodings

An explicit empty /V can select an option whose export string is empty. An explicit empty display string gives a blank caption or list row. A blank list row can still carry the selection highlight

Each list option occupies one visual row. Line and paragraph separators in the displayed label become spaces, and a CRLF pair becomes one space. Selection matching still uses the original decoded export value

In-range whole numbers in /I can select list options by index. If /V is present, the index array must identify exactly the same export values, including repeated values. When the selections disagree, the list highlights the options matching /V. A matching index array can distinguish options with duplicate exports. An invalid /TI starts the list at its first option

An explicit empty /V array clears all list highlights, even when an earlier /I array remains. An empty text string still selects a matching empty export value

A combo box without a normal /AP shows the selected option on one line. Line and paragraph separators in the caption become spaces. The field alignment (/Q) places a fitting caption at the left, center, or right. If no alignment is supplied, a fitting caption is centered. An overwide caption starts at the left edge and clips at the field boundary

A single valid /I index selects the combo caption when that option has the same export value as /V. This distinguishes options with the same export value and different labels. Otherwise, the first matching export supplies the label, or the field value itself is drawn if no option matches. An array /V uses its first element

The caption font, size and color follow the widget /DA when it names a positive size. Otherwise the size is derived from the field height and capped at 12 points. Caption placement uses the field dimensions independently of /Q and /Rotate

Combo box borders and backgrounds follow the explicit appearance colors. /Opt, /V and /I resolve on the widget and then walk /Parent, while /DA and /Q additionally fall back to the catalog /AcroForm

A list box, a choice field whose combo bit is clear, is drawn as a scrollable window of its options, one row per option, so a form built without /AP streams shows every visible entry of its lists on a rendered page rather than a blank rectangle

Each row is the display text of its option taken from the widget /Opt list and falling back to the export value when an option has no separate display text; the selected rows carry a highlight band behind them, an array /V selects each matching row, and the /TI top-index offset decides which option the window starts at, mirroring the classic loaded-field generator

The rows share one text Form laid out without wrapping. Each highlight band uses the same row geometry as the text. The row font, size and color follow /DA, including when the field uses an embedded Type 1 or raw CFF font

Acceptance coverage for this slice, asserting that a combo box renders its caption, that an array /V takes its first element, that the /DA size is honoured, that the /Opt display text is drawn over the export value, that a list box renders its rows with a selection highlight that grows the raster, that /TI scrolls the visible window and that an array /V highlights every matching row on DCC64 Win64, is recorded in Tests/Delphi/ButtonWidgetAppearanceChecks.dpr

Bounds and unfinished handlers

Operation, token, decoded-byte, working-memory and output limits apply to generated geometry, text and fonts; cancellation and failed rendering preserve the same source and publication contracts as existing appearances

Screen without an appearance has no default static image or border; a supplied normal appearance retains priority in both view and print usage

Missing appearances are optional in PDF 1.2–1.7; PDF 2.0 requires appearances except for its specified exceptions, so missing-appearance Path fixtures verify recovery rather than conforming PDF 2.0 writing

Bare CFF2 font streams in existing PDF resources without the companion-table contract remain outside automatic fallback; explicit nondefault coordinates use the variable appearance API and raw tables use the companion-table API; operators outside the documented DA profile and further fallback handlers remain separate limitations

Tr4 through Tr7 use accumulated glyph-outline clips; their four finite two-run controls passed native comparisons and independent MuPDF 1.28.5 and Poppler reader checks, as recorded in the DA topic

Redact fallback uses the annotation rectangle for its preview outline when /QuadPoints is omitted or null. An explicit empty /C array suppresses the outline for both rectangle and quadrilateral previews. The preview leaves page content intact

Static icon styles and text layout can differ between processors; independent formulas and separate MuPDF/Poppler observations are retained in Tests/Linux/HeadlessAnnotationFallback.en-us.md

See native Cairo rendering and ISO 32000-2 annotation errata for renderer and format context

See native cloudy annotation borders for continuous contour construction, Unicode content bounds and the normal acceptance entry points