Enum pdfium_render::page_size::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
sourceimpl 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.
Trait Implementations
sourceimpl Clone for PdfPagePaperSize
impl Clone for PdfPagePaperSize
sourcefn clone(&self) -> PdfPagePaperSize
fn clone(&self) -> PdfPagePaperSize
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more