Expand description
Appearance generation for markup & geometric annotations whose producer
shipped no /AP stream (PDF 32000-1 §12.5.6).
Acrobat writes an appearance stream for every annotation, but many other
producers leave the visual representation implicit in the annotation’s
geometry properties (/QuadPoints, /Vertices, /L, /InkList, /C,
/IC, …). A viewer is expected to synthesize the appearance from those.
This mirrors the form-widget generator in crate::forms: it returns a
GeneratedAppearance (a form XObject — /BBox, /Matrix, /Resources
and a content byte stream) that the interpreter’s annotation painter
replays exactly like a real /AP /N, so both render backends draw it
with no backend changes.
The synthesized content is emitted directly in default user space (the same
space as the annotation’s /Rect and geometry arrays), and the /BBox is
set equal to the /Rect. The painter therefore maps /BBox onto /Rect
as the identity and clips to the rectangle — geometry that extends past
/Rect (as it should not, for a conforming file) is clipped, never scaled.
Supported subtypes: text markup (Highlight / Underline / StrikeOut /
Squiggly, from /QuadPoints), geometric markup (Square / Circle /
Line / Polygon / PolyLine / Ink), FreeText, a conservative Link
border, Text note icons (a small vector glyph chosen by /Name), Stamp
rubber-stamp badges (a bordered label decoded from /Name), a Caret
insertion mark, and Redact redaction-region marks. Everything else (an
existing /AP, Widget, Popup, a PDF 2.0 Projection — which has no
defined default appearance — …) is left to its own appearance or the widget
generator.
Functions§
- generate_
annotation_ appearance - Build a generated appearance for a markup / geometric annotation that has no
/AP, orNonewhen the subtype is unsupported or nothing should be drawn.dictis the annotation dictionary andrectits/Rect.