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
impl PdfPagePaperSize
Sourcepub fn from_points(width: PdfPoints, height: PdfPoints) -> Self
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.
Sourcepub fn from_inches(width: f32, height: f32) -> Self
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.
Sourcepub fn from_cm(width: f32, height: f32) -> Self
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.
Sourcepub fn from_mm(width: f32, height: f32) -> Self
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.
Sourcepub fn new_portrait(size: PdfPagePaperStandardSize) -> Self
pub fn new_portrait(size: PdfPagePaperStandardSize) -> Self
Creates a new portrait PdfPagePaperSize from a standard PdfPagePaperStandardSize.
Sourcepub fn new_landscape(size: PdfPagePaperStandardSize) -> Self
pub fn new_landscape(size: PdfPagePaperStandardSize) -> Self
Creates a new landscape PdfPagePaperSize from a standard PdfPagePaperStandardSize.
Sourcepub fn new_custom(width: PdfPoints, height: PdfPoints) -> Self
pub fn new_custom(width: PdfPoints, height: PdfPoints) -> Self
Creates a new custom PdfPagePaperSize from the given dimensions.
Sourcepub fn a4() -> Self
pub fn a4() -> Self
Creates a new portrait A4 PdfPagePaperSize.
Sourcepub fn a4r() -> Self
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()]
Sourcepub fn a3() -> Self
pub fn a3() -> Self
Creates a new portrait A3 PdfPagePaperSize.
Sourcepub fn rotate(self) -> Self
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.
Sourcepub fn landscape(&self) -> Self
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.
Sourcepub fn portrait(&self) -> Self
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.
Sourcepub fn width(&self) -> PdfPoints
pub fn width(&self) -> PdfPoints
Returns the width of this PdfPagePaperSize.
Sourcepub fn height(&self) -> PdfPoints
pub fn height(&self) -> PdfPoints
Returns the height of this PdfPagePaperSize.
Sourcepub fn as_rect(&self) -> PdfRect
pub fn as_rect(&self) -> PdfRect
Returns the dimensions of this PdfPagePaperSize as a PdfRect.
Trait Implementations§
Source§impl Clone for PdfPagePaperSize
impl Clone for PdfPagePaperSize
Source§fn clone(&self) -> PdfPagePaperSize
fn clone(&self) -> PdfPagePaperSize
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PdfPagePaperSize
impl Debug for PdfPagePaperSize
Source§impl PartialEq for PdfPagePaperSize
impl PartialEq for PdfPagePaperSize
impl Copy for PdfPagePaperSize
impl StructuralPartialEq for PdfPagePaperSize
Auto Trait Implementations§
impl Freeze for PdfPagePaperSize
impl RefUnwindSafe for PdfPagePaperSize
impl Send for PdfPagePaperSize
impl Sync for PdfPagePaperSize
impl Unpin for PdfPagePaperSize
impl UnwindSafe for PdfPagePaperSize
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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