Skip to main content

Page

Struct Page 

Source
pub struct Page {
    pub index: usize,
    pub media_box: Rect,
    pub crop_box: Rect,
    pub rotate: i32,
    pub resources: Dict,
    /* private fields */
}
Expand description

A single page with inherited attributes already applied.

Defaults: media_box falls back to US Letter (612x792) when absent or invalid, crop_box falls back to (and is intersected with) media_box, and rotate is normalized to one of {0, 90, 180, 270}.

Fields§

§index: usize

0-based page index.

§media_box: Rect§crop_box: Rect§rotate: i32§resources: Dict

The page’s (inherited) /Resources dictionary.

Implementations§

Source§

impl Page

Source

pub fn object_ref(&self) -> Option<ObjRef>

The page’s indirect object reference, when the page came from an indirect kid in the page tree (pages inlined directly into a /Kids array have none).

Source

pub fn content(&self, doc: &Document) -> Result<Vec<u8>>

The page’s decoded content: the /Contents stream, or all streams of a /Contents array decoded and joined with b"\n". A missing /Contents yields empty content (lenient).

Source

pub fn size(&self) -> (f32, f32)

Crop-box width and height, swapped when /Rotate is 90 or 270.

Source

pub fn dict(&self) -> &Dict

The raw page dictionary.

Auto Trait Implementations§

§

impl Freeze for Page

§

impl RefUnwindSafe for Page

§

impl Send for Page

§

impl Sync for Page

§

impl Unpin for Page

§

impl UnsafeUnpin for Page

§

impl UnwindSafe for Page

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