Skip to main content

Module annotations

Module annotations 

Source
Expand description

Typed PDF annotations (links, sticky notes, highlights, stamps, callouts, attachments, etc.).

stet-pdf-reader already knows about the /Annots array on each page and renders annotation appearance streams during page rasterization (content/mod.rs::render_annotation). This module exposes the same annotations as structured data for callers that want to inspect, index, or convert them — link extractors, review aggregators, accessibility tools.

The full PDF annotation set is large (ISO 32000-2 §12.5). This module parses the common subtypes — Link, Text, FreeText, the four markup annotations (Highlight / Underline / Squiggly / StrikeOut), Line, Square, Circle, Polygon, PolyLine, Ink, Stamp, Caret, FileAttachment, Popup — into typed structs. Less-common subtypes (Screen, PrinterMark, TrapNet, Watermark, Sound, Movie, Widget, and any unknown) are exposed via AnnotationKindData::Minimal with the common fields populated; consumers can still inspect subtype and kind_data’s Other variant for the raw name.

Widget annotations get a placeholder here; Phase 5 of the reader plan adds the dedicated FormField type that cross-links them to the document’s AcroForm.

Structs§

Annotation
One PDF annotation.
AnnotationFlags
/F annotation flags.
Border
/Border entry: [hradius vradius width [dash]].
CaretAnnotation
/Subtype /Caret.
FileAttachmentAnnotation
/Subtype /FileAttachment.
FreeTextAnnotation
/Subtype /FreeText — visible text on the page.
InkAnnotation
/Subtype /Ink.
LineAnnotation
/Subtype /Line.
LinkAnnotation
/Subtype /Link.
MarkupAnnotation
Markup annotations (Highlight / Underline / Squiggly / StrikeOut).
PolygonAnnotation
/Subtype /Polygon or /PolyLine.
PopupAnnotation
/Subtype /Popup.
ShapeAnnotation
/Subtype /Square or /Circle.
StampAnnotation
/Subtype /Stamp.
TextAnnotation
/Subtype /Text — sticky note.

Enums§

AnnotationColor
/C color array — interpreted by length per spec.
AnnotationDate
/M modification entry — usually a PDF date string, occasionally an arbitrary string.
AnnotationKind
Annotation subtype.
AnnotationKindData
Subtype-specific annotation data.

Functions§

parse_annotation
Parse a single annotation dict into a typed Annotation.
parse_page_annotations
Parse all annotations on a page from its PageInfo::annots list.