Skip to main content

AnnotationKind

Enum AnnotationKind 

Source
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

§open: bool

/Open — true ⇒ pop-up displayed at document open.

§icon: String

/Name — icon identifier (Comment, Note, Help, NewParagraph, Paragraph, Insert, plus authoring-tool extensions). Defaults to Note per Table 172.

§state: Option<String>

/State + /StateModel — review or marked state.

§state_model: Option<String>
§

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).

§quadding: u8

/Q — quadding (justification): 0 left-justified (default), 1 centred, 2 right-justified.

§rich_content: Option<String>

/RC rich content (XHTML).

§intent: Option<String>

/IT intent — FreeText, FreeTextCallout, FreeTextTypeWriter.

§

Stamp

/Subtype /Stamp — rubber-stamp (§12.5.6.13 Table 184).

Fields

§icon: String

/Name icon identifier — Approved, Experimental, NotApproved, AsIs, Expired, NotForPublicRelease, Confidential, Final, Sold, Departmental, ForComment, TopSecret, Draft, ForPublicRelease. Defaults to Draft per Table 184.

§

TextMarkup

Text-markup family (§12.5.6.10 Table 179).

Fields

§variant: TextMarkupVariant

Which markup variant: Highlight, Underline, Squiggly, StrikeOut.

§quad_points: Vec<f32>

/QuadPoints — 8N reals giving the quads of every region covered by the markup. PDF 2.0 changed the legal vertex order; round-26 surfaces the raw list untouched.

§

Geometry

/Subtype /Square or /Circle (§12.5.6.8 Table 177).

Fields

§is_square: bool

Square ⇒ true; Circle ⇒ false.

§interior_colour: Option<Vec<f32>>

/IC interior colour — same shape as outer /C.

§rect_diffs: Option<[f32; 4]>

/RD rectangle differences — [left top right bottom] inset of the geometric figure inside /Rect. Optional.

/Subtype /Link — go-to / URI link (§12.5.6.5 Table 173). Target decoded the same way crate::reader::link does it.

Fields

§

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

§field_type: Option<String>

/FT — field type Name (Btn, Tx, Ch, Sig).

§field_name: Option<String>

/T — partial field name.

§value: Option<String>

/V — current value text (Names + strings collapse to a String form; nullNone).

§

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

§l: [f32; 4]

/L[x1 y1 x2 y2] endpoints in default user space. Required per Table 175.

§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).

§leader_line_offset: Option<f32>

/LLO — leader-line offset (PDF 1.7, ≥ 0). None when omitted.

§cap: bool

/Cap — true iff the Contents / RC text should be drawn as a caption on the line (Figure 61 / 62). Defaults to false per Table 175.

§intent: Option<String>

/IT intent (LineArrow / LineDimension); raw name preserved.

§

PolygonOrPolyLine

/Subtype /Polygon or /Subtype /PolyLine — closed-polygon or open-polyline markup (§12.5.6.9 Table 178, round 197).

Fields

§is_polygon: bool

true for Polygon, false for PolyLine.

§vertices: Vec<f32>

/Vertices — alternating [x1 y1 x2 y2 …] in default user space.

§line_endings: Option<[String; 2]>

/LE line endings (PolyLine only per spec). Same two-name shape as Line::line_endings.

§interior_colour: Option<Vec<f32>>

/IC interior colour (same layout as Line).

§intent: Option<String>

/IT intent — PolygonCloud, PolyLineDimension, PolygonDimension.

§

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

§ink_list: Vec<Vec<f32>>

/InkList — one Vec<f32> per stroked path, each a flat [x0 y0 x1 y1 …] series in default user space.

§

Caret

/Subtype /Caret — text-edit caret (§12.5.6.11 Table 180, round 197).

Fields

§rect_diffs: Option<[f32; 4]>

/RD rectangle differences inside /Rect, optional.

§symbol: String

/Sy — paragraph symbol. P ⇒ paragraph mark, None ⇒ no symbol. Defaults to None per Table 180.

§

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

§parent: Option<ObjectId>

/Parent — indirect reference to the parent markup annotation, preserved as an ObjectId so callers can re-resolve. None when omitted (the spec considers this malformed — Popup with no parent has no editing target — but tolerant readers still surface the dict).

§open: bool

/Open — initial visibility (defaults to false per Table 183).

§

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

/Repeattrue ⇒ 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.

§quadding: u8

/Q — overlay-text justification: 0 left (default), 1 centre, 2 right. Ignored when /RO is present.

§

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

§sound: Option<ObjectId>

/Sound indirect reference — §13.3 sound stream object. Preserved verbatim so callers can re-resolve the stream dictionary (sample rate, channels, encoding, bytes) on demand. None when the entry is absent or a direct stream (no indirect target to surface).

§icon: String

/Name icon identifier — Speaker (default per Table 185), Mic, or an authoring-tool extension name.

§

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

§title: Option<String>

/T — title of the screen annotation. Optional per Table 187.

§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).

§additional_actions: Option<ObjectId>

/AA — additional-actions dictionary (§12.6.3 Trigger Events) for event-driven behaviour (page-open, mouse-down, focus-gain, …). Preserved as ObjectId; the round-36 actions reader handles the per-trigger walk.

§

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).

§annot_states: Option<Vec<Option<String>>>

/AnnotStates — appearance-state Names (one per per-page annotation, in the page’s /Annots order). The spec allows a null element for annotations with no /AS entry; the reader surfaces None for those slots. None at the outer level when the entry is absent.

§font_fauxing: Option<Vec<ObjectId>>

/FontFauxing — references to fonts substituted during trap-network generation. None when the entry is absent.

§

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.

Fields

§subtype: String

Trait Implementations§

Source§

impl Clone for AnnotationKind

Source§

fn clone(&self) -> AnnotationKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AnnotationKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V