pub enum Subtype {
Show 29 variants
Unknown,
Text,
Link,
FreeText,
Line,
Square,
Circle,
Polygon,
PolyLine,
Highlight,
Underline,
Squiggly,
StrikeOut,
Stamp,
Caret,
Ink,
Popup,
FileAttachment,
Sound,
Movie,
Widget,
Screen,
PrinterMark,
TrapNet,
Watermark,
ThreeD,
RichMedia,
XfaWidget,
Redact,
}Expand description
An annotation’s /Subtype.
The variant order is API: it is the numbering the public annotation
interface exposes, and the --annot dump’s subtype names come from the
same table. Three spellings differ from their variant names — ThreeD is
3D, XfaWidget is XFAWidget, and PolyLine keeps its capital L.
Variants§
Unknown
A /Subtype matching none of the known spellings, or none at all.
Text
A sticky note.
Link
A hyperlink or destination jump.
FreeText
Free text drawn directly on the page.
Line
A straight line.
Square
A rectangle.
Circle
An ellipse.
Polygon
A closed polygon.
PolyLine
An open polyline.
Highlight
Highlighted text.
Underline
Underlined text.
Squiggly
Text with a wavy underline.
StrikeOut
Struck-out text.
Stamp
A rubber stamp.
Caret
An editorial caret.
Ink
Freehand ink strokes.
Popup
A pop-up note attached to another annotation.
FileAttachment
An attached file.
Sound
A sound clip.
Movie
A movie clip.
Widget
A form field’s on-page control.
Screen
An embedded media screen.
PrinterMark
A printer’s mark.
TrapNet
A trapping network.
Watermark
A watermark.
ThreeD
Three-dimensional artwork.
RichMedia
Rich media.
XfaWidget
An XFA form control.
Redact
A redaction region.
Implementations§
Source§impl Subtype
impl Subtype
Sourcepub fn from_bytes(bytes: &[u8]) -> Subtype
pub fn from_bytes(bytes: &[u8]) -> Subtype
Reads a /Subtype spelling. Anything unrecognized is
Subtype::Unknown.
use pdfrum_doc::Subtype;
assert_eq!(Subtype::from_bytes(b"Widget"), Subtype::Widget);
// Matching is exact: no case folding, and `3D` is spelled `3D`.
assert_eq!(Subtype::from_bytes(b"widget"), Subtype::Unknown);
assert_eq!(Subtype::from_bytes(b"3D"), Subtype::ThreeD);Sourcepub fn as_bytes(self) -> &'static [u8] ⓘ
pub fn as_bytes(self) -> &'static [u8] ⓘ
The spelling. Subtype::Unknown has none and answers empty.
use pdfrum_doc::Subtype;
assert_eq!(Subtype::XfaWidget.as_bytes(), b"XFAWidget");
assert_eq!(Subtype::Unknown.as_bytes(), b"");Sourcepub fn is_text_markup(self) -> bool
pub fn is_text_markup(self) -> bool
The four text markup subtypes, whose drawing rectangle comes from their quadrilaterals once an appearance has been generated.
This is not the same set as Subtype::has_attachment_points,
which the --annot dump uses and which also admits links.
use pdfrum_doc::Subtype;
assert!(Subtype::Highlight.is_text_markup());
assert!(!Subtype::Link.is_text_markup());Sourcepub fn has_attachment_points(self) -> bool
pub fn has_attachment_points(self) -> bool
Whether the dump prints a quadpoint count for this subtype.
Links are in the set, which is why every link in the corpus prints
Number of quadpoints sets: 0.
use pdfrum_doc::Subtype;
assert!(Subtype::Link.has_attachment_points());
assert!(!Subtype::Square.has_attachment_points());