pub enum AnnotationKind {
Show 22 variants
Text {
open: bool,
icon: String,
state: Option<String>,
state_model: Option<String>,
},
FreeText {
default_appearance: Option<String>,
quadding: u8,
rich_content: Option<String>,
intent: Option<String>,
},
Stamp {
icon: String,
},
TextMarkup {
variant: TextMarkupVariant,
quad_points: Vec<f32>,
},
Geometry {
is_square: bool,
interior_colour: Option<Vec<f32>>,
rect_diffs: Option<[f32; 4]>,
},
Link {
target: Option<PdfLinkTarget>,
},
Widget {
field_type: Option<String>,
field_name: Option<String>,
value: Option<String>,
},
Line {
l: [f32; 4],
line_endings: Option<[String; 2]>,
interior_colour: Option<Vec<f32>>,
leader_line: Option<f32>,
leader_line_extension: Option<f32>,
leader_line_offset: Option<f32>,
cap: bool,
intent: Option<String>,
},
PolygonOrPolyLine {
is_polygon: bool,
vertices: Vec<f32>,
line_endings: Option<[String; 2]>,
interior_colour: Option<Vec<f32>>,
intent: Option<String>,
},
Ink {
ink_list: Vec<Vec<f32>>,
},
Caret {
rect_diffs: Option<[f32; 4]>,
symbol: String,
},
Popup {
parent: Option<ObjectId>,
open: bool,
},
Watermark {
fixed_print: Option<FixedPrint>,
},
Redact {
quad_points: Option<Vec<f32>>,
interior_colour: Option<[f32; 3]>,
overlay_form: Option<ObjectId>,
overlay_text: Option<String>,
repeat: bool,
default_appearance: Option<String>,
quadding: u8,
},
FileAttachment {
icon: String,
file_name: Option<String>,
filespec: Option<ObjectId>,
},
Sound {
sound: Option<ObjectId>,
icon: String,
},
Movie {
title: Option<String>,
movie: Option<ObjectId>,
activation: MovieActivation,
},
Screen {
title: Option<String>,
appearance_chars: Option<ObjectId>,
action: Option<ObjectId>,
additional_actions: Option<ObjectId>,
},
PrinterMark {
mark_name: Option<String>,
},
TrapNet {
last_modified: Option<String>,
version: Option<Vec<ObjectId>>,
annot_states: Option<Vec<Option<String>>>,
font_fauxing: Option<Vec<ObjectId>>,
},
ThreeD {
artwork: Option<ObjectId>,
view: Option<ThreeDViewSelector>,
activation: ThreeDActivation,
interactive: bool,
view_box: Option<[f32; 4]>,
},
Other {
subtype: String,
},
}Expand description
Per-subtype annotation payload.
The /Subtype name from §12.5.6 maps to one of these variants;
unknown subtypes fall through to Self::Other.
Variants§
Text
/Subtype /Text — sticky-note (§12.5.6.4 Table 172).
Fields
FreeText
/Subtype /FreeText — in-page text box (§12.5.6.6 Table 174).
Fields
default_appearance: Option<String>/DA default appearance string (a content-stream snippet
per §12.7.3.3 — /Helv 12 Tf 0 g-style).
Stamp
/Subtype /Stamp — rubber-stamp (§12.5.6.13 Table 184).
Fields
TextMarkup
Text-markup family (§12.5.6.10 Table 179).
Fields
variant: TextMarkupVariantWhich markup variant: Highlight, Underline, Squiggly,
StrikeOut.
Geometry
/Subtype /Square or /Circle (§12.5.6.8 Table 177).
Fields
Link
/Subtype /Link — go-to / URI link (§12.5.6.5 Table 173).
Target decoded the same way crate::reader::link does it.
Fields
target: Option<PdfLinkTarget>Widget
/Subtype /Widget — interactive form widget (§12.5.6.19
Table 188 + §12.7.4 Table 220 field-shared keys). Round-26
surfaces the field-trio (field_type, field_name, value)
when the widget dictionary is the field dictionary itself
(the most common shape).
Fields
Line
/Subtype /Line — straight-line markup (§12.5.6.7 Table 175,
round 197). Two-endpoint line on the page; the Rect field
is the bounding box, the L endpoints carry the line itself.
Fields
line_endings: Option<[String; 2]>/LE — two-element line-ending styles. Per Table 175 the
default is [/None /None]; the spec values are listed in
Table 176 (Square, Circle, Diamond, OpenArrow,
ClosedArrow, None, Butt, ROpenArrow,
RClosedArrow, Slash). Round-197 surfaces them raw —
callers that care about rendering compare strings.
interior_colour: Option<Vec<f32>>/IC interior colour for filled line-ending shapes (same
0/1/3/4-component layout as the outer /C).
leader_line: Option<f32>/LL — leader-line length, in default user-space units.
Positive values lead clockwise from start→end (per spec
Figure 60). None when omitted (default 0 per Table 175).
leader_line_extension: Option<f32>/LLE — leader-line extension length (≥ 0). None when
omitted (default 0 per Table 175).
PolygonOrPolyLine
/Subtype /Polygon or /Subtype /PolyLine — closed-polygon
or open-polyline markup (§12.5.6.9 Table 178, round 197).
Fields
Ink
/Subtype /Ink — freehand scribble (§12.5.6.13 Table 182,
round 197). Round-trip target for the round-32
write_pdf_with_annotations Ink writer.
Fields
Caret
/Subtype /Caret — text-edit caret (§12.5.6.11 Table 180,
round 197).
Fields
Popup
/Subtype /Popup — text editor for a markup parent
(§12.5.6.14 Table 183, round 197). Per Table 169 Popup is not
itself a markup type — it hangs off a parent markup annot via
/Parent (an indirect reference per Table 183).
Fields
Watermark
/Subtype /Watermark — fixed-position printed graphics
(§12.5.6.22 Table 190, round 204). Round-204 surfaces the
optional /FixedPrint dict (§12.5.6.22 Table 191): printing
applications use the /Matrix + /H / /V percentages to
position the watermark relative to the printed media (not
the PDF page), so a screen viewer and a print path render
the same dict differently.
Fields
fixed_print: Option<FixedPrint>Decoded /FixedPrint dictionary, when present. None
means the watermark has no media-relative positioning —
per Table 190 it is then drawn without any special
consideration for the dimensions of the target media.
Redact
/Subtype /Redact — redaction marker (§12.5.6.23 Table 192,
round 204). The round-26 reader is non-destructive: it
surfaces every redact dict it can decode, but applying the
redaction (actually destroying the underlying content) is a
separate higher-level pass. This variant carries the spec’s
content-region + overlay-appearance fields verbatim so a
privacy-audit tool can enumerate what would be removed by a
PDF 1.7-compliant redactor without invoking that destructive
path.
Fields
quad_points: Option<Vec<f32>>/QuadPoints — 8N reals giving the quads of the content
region intended for removal. When omitted the spec falls
back to the outer /Rect; round-204 surfaces None so
callers can distinguish “explicit empty” vs “use Rect”.
interior_colour: Option<[f32; 3]>/IC — DeviceRGB fill applied after content removal
(three components in 0..=1). Ignored by the spec when
/RO is present.
overlay_form: Option<ObjectId>/RO indirect reference — Form XObject overlay
appearance (§8.10). Round-204 surfaces the ObjectId
so callers can re-resolve; payload decoding is left to
the consumer because the overlay stream is a generic
Form XObject (/Subtype /Form), not a redact-specific
shape.
overlay_text: Option<String>/OverlayText — text-string drawn over the redacted
region after removal. Ignored per spec when /RO is
present.
repeat: bool/Repeat — true ⇒ the overlay text tiles to fill the
region. Defaults to false per Table 192. Ignored when
/RO is present.
default_appearance: Option<String>/DA — appearance string for the overlay text (the
/Helv 12 Tf 0 g-style content snippet from §12.7.3.3).
“Required if OverlayText is present, ignored otherwise”
per Table 192; surfaced as raw bytes so callers can
re-feed the snippet through the content-stream parser.
FileAttachment
/Subtype /FileAttachment — embedded-file marker
(§12.5.6.15 Table 184, round 197). Round-trip target for the
round-33 write_pdf_with_attachments annotation marker.
Fields
icon: String/Name icon — defaults to PushPin per Table 184. The
spec also names GraphPushPin and PaperclipTag;
additional names may be supported.
file_name: Option<String>User-visible file name resolved from the /FS filespec.
Prefers /UF (UTF-16BE-with-BOM) over /F
(PDFDocEncoded) per §7.11.2 Table 43, matching the
round-33 attachment reader’s behaviour. None when the
filespec is missing, unresolvable, or carries neither
name field.
filespec: Option<ObjectId>/FS filespec indirect-reference target, preserved so
callers can correlate the annotation with an entry from
read_pdf_attachments (same ObjectId). None when the
/FS entry is a direct dictionary rather than a
reference (rare but legal — the spec only requires the
entry to be a “file specification”).
Sound
/Subtype /Sound — sound annotation (§12.5.6.16 Table 185,
round 209). The §13.3 sound stream itself is preserved as an
ObjectId rather than decoded — this crate doesn’t bundle an
audio decoder, and consumers that care about playback already
route raw streams through one of the workspace’s audio codec
crates. The sound stream is required per Table 185; a Sound
annotation that lacks /Sound (malformed) surfaces None and
is still enumerated rather than dropped, matching the round-197
tolerant-reader contract every other subtype follows.
Fields
Movie
/Subtype /Movie — movie annotation (§12.5.6.17 Table 186,
round 209). The §13.4 movie metadata is preserved as an
ObjectId when it’s an indirect reference rather than decoded
— this crate doesn’t decode video; consumers route the resolved
movie dict through the appropriate video codec crate themselves.
Fields
title: Option<String>/T title — text string §12.6.4.9 movie actions use to
look up this annotation by name. Optional per Table 186.
movie: Option<ObjectId>/Movie — §13.4 movie dictionary. Preserved as ObjectId
when the entry is an indirect reference (the common shape
because the movie dict carries large indirect data blocks);
surfaced as None when the dict is inline (rare — the
outer Movie annotation dict and inline movie dict would
share the same key namespace, which the spec example in
§13.4 does not do). Required per Table 186; malformed
dicts still enumerate to keep audit-walks complete.
activation: MovieActivation/A activation — tri-state collapse of the spec’s
“boolean or dictionary” shape. MovieActivation::Play for
true (the Table 186 default), MovieActivation::Dont for
false, MovieActivation::Custom(id) for an indirect
reference to a movie-activation dict (preserved verbatim
so callers can re-resolve the §13.4 activation parameters).
Screen
/Subtype /Screen — screen annotation (§12.5.6.18 Table 187,
round 209). Screen annotations exist to anchor §12.6.4.13
rendition actions to a region of a page; round-209 surfaces the
title, the appearance-characteristics /MK dict reference, and
the /A / /AA action references. Rendition-action decoding
itself is downstream of round-26 actions and remains out of
scope for the annotation reader.
Fields
appearance_chars: Option<ObjectId>/MK — appearance characteristics dictionary (Table 189)
preserved as ObjectId when the entry is an indirect
reference. The /I sub-entry of this dict provides the
icon used by /AP; round-209 doesn’t traverse /MK itself
because the same dict shape is used by Widget annotations
(and is therefore better surfaced through a shared decoder
in a follow-up round).
action: Option<ObjectId>/A — action triggered when the annotation is activated.
Preserved as ObjectId so callers can re-resolve through
the round-36 actions reader. Inline action dicts are not
surfaced here because the round-36 reader walks indirect
actions anyway and a screen annotation’s /A is, in
practice, always an indirect reference to a rendition
action dict (§12.6.4.13).
PrinterMark
/Subtype /PrinterMark — production printer’s mark
(§12.5.6.20 + Table 362, round 215). PDF 1.4. Carries the
optional /MN mark-name identifier (e.g. ColorBar,
RegistrationTarget, CutMark). The actual mark glyphs live
in the form-XObject appearance stream referenced from /AP /N;
the round-26 reader doesn’t surface appearance streams (those
stay routed through the §8.10 Form XObject walker), so the
round-215 enumeration is the mark-type metadata only.
Fields
mark_name: Option<String>/MN — arbitrary mark-name Name identifying the type of
printer’s mark (Table 362). None when the producer
omitted the entry (the spec makes it optional). Common
values seen in the wild include ColorBar,
RegistrationTarget, CutMark, PageInformation, but
the spec does not enumerate a closed set — the raw Name is
preserved verbatim so a colour-management tool can match
its own taxonomy.
TrapNet
/Subtype /TrapNet — page-level trap network
(§12.5.6.21 + Table 366, round 215). PDF 1.3. Carries either
the /LastModified date or the /Version + /AnnotStates
pair (the spec rules these out as mutually exclusive); the
optional /FontFauxing array of font references is also
surfaced so a trap-network validator can detect substitutions.
Per §12.5.6.21 a page has at most one TrapNet annotation, and
it must be the last element of the page’s /Annots array —
the round-26 walker enumerates whatever the producer wrote.
Fields
last_modified: Option<String>/LastModified — date string per §7.9.4 (PDF D: form),
when present. The spec marks this “Required if Version
and AnnotStates are absent” so a well-formed TrapNet
annotation has either this or the version-array pair.
version: Option<Vec<ObjectId>>/Version — unordered array of indirect references to
every object whose change would invalidate the trap
network. Surfaced as a Vec<ObjectId> so a regenerator
can enumerate the candidates. None when the entry is
absent (in which case /LastModified carries the
invalidation watermark).
ThreeD
/Subtype /3D — 3D artwork annotation (§13.6.2 Table 298,
round 220). PDF 1.6. Surfaces the artwork reference, the
initial view selector, the activation behaviour, the
interactive-use flag, and the 3D view box. The actual 3D
stream (§13.6.3 U3D / PRC payload) is preserved as
ObjectId — this crate does not decode 3D artwork.
Fields
artwork: Option<ObjectId>/3DD — the 3D stream (§13.6.3) or 3D reference dict
(§13.6.3.3) that carries the artwork. Required per
Table 298. Surfaced as ObjectId when an indirect
reference (the common shape — both streams and reference
dicts are always indirect); None if the producer
inlined a dict directly or omitted the key entirely
(the reader is tolerant of the latter so a forensic
walk still surfaces the annotation skeleton).
view: Option<ThreeDViewSelector>/3DV — the initial view to use when the annotation
is activated. Spec types this as one of: a 3D view
dictionary (indirect ref), an integer index into the
stream’s /VA array, a text string matching a view’s
/IN entry, or a Name F / L / D selecting the
first / last / default /VA entry. None when absent
(Table 298 default: “the default view in the 3D stream
object specified by 3DD”).
activation: ThreeDActivation/3DA — activation dictionary (Table 299) that governs
when the annotation activates / deactivates and what
state the artwork instance shall be in. Defaults are
applied per Table 299 when the entry is absent (the
reader returns Some(ThreeDActivation::default())) so
the spec’s “Default value: an activation dictionary
containing default values for all its entries” is
honoured at the API level.
interactive: bool/3DI — interactive-use flag. true ⇒ a conforming
reader should expose interactive rotate/pan/zoom
controls; false ⇒ the artwork is driven entirely by
scripts/animations. Defaults to true per Table 298
when absent.
view_box: Option<[f32; 4]>/3DB — the 3D view box (rectangle in the annotation’s
target coordinate system; the origin is the centre of
the annotation rectangle). None when absent; the
spec default is the annotation’s /Rect expressed in
the target coordinate system, i.e. [-w/2 -h/2 w/2 h/2],
which the caller can compute from the outer
PdfAnnotation::rect field if needed.
Other
Subtype this round doesn’t decode — name surfaced verbatim.
Trait Implementations§
Source§impl Clone for AnnotationKind
impl Clone for AnnotationKind
Source§fn clone(&self) -> AnnotationKind
fn clone(&self) -> AnnotationKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more