Skip to main content

Subtype

Enum Subtype 

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

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

Source

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);
Source

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"");
Source

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());
Source

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());

Trait Implementations§

Source§

impl Clone for Subtype

Source§

fn clone(&self) -> Self

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 Copy for Subtype

Source§

impl Debug for Subtype

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Subtype

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Subtype

Source§

impl PartialEq for Subtype

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Subtype

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<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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.