PdfPagePaperSize

Enum PdfPagePaperSize 

Source
pub enum PdfPagePaperSize {
    Portrait(PdfPagePaperStandardSize),
    Landscape(PdfPagePaperStandardSize),
    Custom(PdfPoints, PdfPoints),
}
Expand description

The paper size of a PdfPage.

Variants§

§

Portrait(PdfPagePaperStandardSize)

A known paper size in portrait orientation.

§

Landscape(PdfPagePaperStandardSize)

A known paper size in landscape orientation.

§

Custom(PdfPoints, PdfPoints)

A custom paper size, expressed as a (width, height) tuple in PdfPoints.

Implementations§

Source§

impl PdfPagePaperSize

Source

pub fn from_points(width: PdfPoints, height: PdfPoints) -> Self

Returns the PdfPagePaperSize matching the given dimensions, or PdfPagePaperSize::Custom if no match can be made.

Source

pub fn from_inches(width: f32, height: f32) -> Self

Returns the PdfPagePaperSize matching the given dimensions, or PdfPagePaperSize::Custom if no match can be made.

Source

pub fn from_cm(width: f32, height: f32) -> Self

Returns the PdfPagePaperSize matching the given dimensions, or PdfPagePaperSize::Custom if no match can be made.

Source

pub fn from_mm(width: f32, height: f32) -> Self

Returns the PdfPagePaperSize matching the given dimensions, or PdfPagePaperSize::Custom if no match can be made.

Source

pub fn new_portrait(size: PdfPagePaperStandardSize) -> Self

Creates a new portrait PdfPagePaperSize from a standard PdfPagePaperStandardSize.

Source

pub fn new_landscape(size: PdfPagePaperStandardSize) -> Self

Creates a new landscape PdfPagePaperSize from a standard PdfPagePaperStandardSize.

Source

pub fn new_custom(width: PdfPoints, height: PdfPoints) -> Self

Creates a new custom PdfPagePaperSize from the given dimensions.

Source

pub fn a4() -> Self

Creates a new portrait A4 PdfPagePaperSize.

Source

pub fn a4r() -> Self

Creates a new portrait A4R PdfPagePaperSize, equivalent to landscape A4. In terms of paper size, this is equivalent to calling [PdfPagePaperSize::a4().to_landscape()]

Source

pub fn a3() -> Self

Creates a new portrait A3 PdfPagePaperSize.

Source

pub fn rotate(self) -> Self

Rotates a landscape PdfPagePaperSize into a portrait PdfPagePaperSize and vice versa, consuming this PdfPagePaperSize.

Custom sizes have their height and width dimensions swapped.

Source

pub fn landscape(&self) -> Self

Rotates a portrait PdfPagePaperSize into a landscape PdfPagePaperSize if necessary. A new PdfPagePaperSize value is returned; this PdfPagePaperSize is not affected. Sizes already in landscape are not changed. Custom sizes are changed only if the current height is greater than the width, in which case the dimensions are swapped.

Source

pub fn portrait(&self) -> Self

Rotates a landscape PdfPagePaperSize into a portrait PdfPagePaperSize if necessary. A new PdfPagePaperSize value is returned; this PdfPagePaperSize is not affected. Sizes already in portrait are not changed. Custom sizes are changed only if the current width is greater than the height, in which case the dimensions are swapped.

Source

pub fn width(&self) -> PdfPoints

Returns the width of this PdfPagePaperSize.

Source

pub fn height(&self) -> PdfPoints

Returns the height of this PdfPagePaperSize.

Source

pub fn as_rect(&self) -> PdfRect

Returns the dimensions of this PdfPagePaperSize as a PdfRect.

Trait Implementations§

Source§

impl Clone for PdfPagePaperSize

Source§

fn clone(&self) -> PdfPagePaperSize

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PdfPagePaperSize

Source§

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

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

impl PartialEq for PdfPagePaperSize

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for PdfPagePaperSize

Source§

impl StructuralPartialEq for PdfPagePaperSize

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