PdfPageBoundaries

Struct PdfPageBoundaries 

Source
pub struct PdfPageBoundaries<'a> { /* private fields */ }
Expand description

The page boundaries of a single PdfPage.

The content of a page can be bounded by up to six different boxes:

  • Media box: the full page size, equivalent to the target paper size when the document is printed. All other page boundaries must fit inside the Media box.
  • Art box: the maximum extent of out-of-bleed page art when offset printing. Typically cropped out when viewing the document on-screen.
  • Bleed box: the maximum extent of outside-trim page bleeds when offset printing. Typically cropped out when viewing the document on-screen.
  • Trim box: the maximum extent of page trims when offset printing. Typically cropped out when viewing the document on-screen.
  • Crop box: the maximum extent of user-visible content when viewing the document on-screen.
  • Bounding box (“BBox”): the smallest rectangle that can enclose all the content contained in the page.

These boundaries are concentric, i.e. the Bounding box must fit within the Crop box, which must fit within the Trim box, and so on. The Media box therefore contains all other boxes. Not all boxes are guaranteed to exist for all pages.

For more information, see section 10.10.1 on page 962 of the PDF Reference Manual version 1.7, or visit: https://www.pdfscripting.com/public/PDF-Page-Coordinates.cfm#UserSpace

Implementations§

Source§

impl<'a> PdfPageBoundaries<'a>

Source

pub fn bindings(&self) -> &'a dyn PdfiumLibraryBindings

Returns the PdfiumLibraryBindings used by this PdfPageBoundaries collection.

Source

pub fn get( &self, boundary: PdfPageBoundaryBoxType, ) -> Result<PdfPageBoundaryBox, PdfiumError>

Returns the boundary box defined for the containing PdfPage matching the given PdfPageBoundaryBoxType, if any.

Source

pub fn set( &mut self, box_type: PdfPageBoundaryBoxType, rect: PdfRect, ) -> Result<(), PdfiumError>

Sets the boundary box matching the given PdfPageBoundaryBoxType to the given PdfRect for the containing PdfPage.

Source

pub fn media(&self) -> Result<PdfPageBoundaryBox, PdfiumError>

Returns the Media boundary box defined for the containing PdfPage, if any. The Media box is the full page size, equivalent to the target paper size when the document is printed.

Source

pub fn set_media(&mut self, rect: PdfRect) -> Result<(), PdfiumError>

Sets the Media boundary box for the containing PdfPage to the given PdfRect.

Source

pub fn art(&self) -> Result<PdfPageBoundaryBox, PdfiumError>

Returns the Art boundary box defined for the containing PdfPage, if any. The Art box is the maximum extent of out-of-bleed page art when offset printing. It is typically cropped out when viewing the document on-screen.

Source

pub fn set_art(&mut self, rect: PdfRect) -> Result<(), PdfiumError>

Sets the Art boundary box for the containing PdfPage to the given PdfRect.

Source

pub fn bleed(&self) -> Result<PdfPageBoundaryBox, PdfiumError>

Returns the Bleed boundary box defined for the containing PdfPage, if any. The Bleed box is the maximum extent of outside-trim page bleeds when offset printing. It is typically cropped out when viewing the document on-screen.

Source

pub fn set_bleed(&mut self, rect: PdfRect) -> Result<(), PdfiumError>

Sets the Bleed boundary box for the containing PdfPage to the given PdfRect.

Source

pub fn trim(&self) -> Result<PdfPageBoundaryBox, PdfiumError>

Returns the Trim boundary box defined for the containing PdfPage, if any. The Trim box is the maximum extent of page trims when offset printing. It is typically cropped out when viewing the document on-screen.

Source

pub fn set_trim(&mut self, rect: PdfRect) -> Result<(), PdfiumError>

Sets the Trim boundary box for the containing PdfPage to the given PdfRect.

Source

pub fn crop(&self) -> Result<PdfPageBoundaryBox, PdfiumError>

Returns the Crop boundary box defined for the containing PdfPage, if any. The Crop box is the maximum extent of user-visible content when viewing the document on-screen.

Source

pub fn set_crop(&mut self, rect: PdfRect) -> Result<(), PdfiumError>

Sets the Crop boundary box for the containing PdfPage to the given PdfRect.

Source

pub fn bounding(&self) -> Result<PdfPageBoundaryBox, PdfiumError>

Returns the Bounding box (“BBox”) defined for the containing PdfPage, if any. The BBox is the smallest rectangle that can enclose all the content contained in the page. Unlike other boundary boxes, the BBox is computed dynamically on request and cannot be set explicitly.

Source

pub fn iter(&'a self) -> PageBoundaryIterator<'a>

Returns an iterator over all defined PdfPageBoundaryBox boxes in the containing PdfPage. Not all boxes are guaranteed to exist for all pages, but where they are defined they will be returned strictly in enclosing order from outermost to innermost: Media, Art, Bleed, Trim, Crop, Bounding.

Auto Trait Implementations§

§

impl<'a> Freeze for PdfPageBoundaries<'a>

§

impl<'a> !RefUnwindSafe for PdfPageBoundaries<'a>

§

impl<'a> !Send for PdfPageBoundaries<'a>

§

impl<'a> !Sync for PdfPageBoundaries<'a>

§

impl<'a> Unpin for PdfPageBoundaries<'a>

§

impl<'a> !UnwindSafe for PdfPageBoundaries<'a>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.