Skip to main content

Page

Struct Page 

Source
pub struct Page { /* private fields */ }
Expand description

A page under construction. Obtain one with PdfDoc::add_page.

Implementations§

Source§

impl Page

Source

pub fn width(&self) -> f32

Source

pub fn height(&self) -> f32

Adds an invisible clickable area for an external URI. Invalid or excessive links are ignored.

Adds a link to a location on another page of this document (zero-based page index).

Source

pub fn save(&mut self)

Saves the graphics state (pair with Page::restore).

Source

pub fn restore(&mut self)

Restores the graphics state saved by Page::save; extra calls are ignored.

Source

pub fn clip_rect(&mut self, x: f32, y: f32, w: f32, h: f32)

Intersects the clip with a rectangle (until the next Page::restore).

Source

pub fn fill_rect(&mut self, x: f32, y: f32, w: f32, h: f32, color: Rgb)

Source

pub fn rect_stroke( &mut self, x: f32, y: f32, w: f32, h: f32, width: f32, color: Rgb, )

Source

pub fn stroke_line( &mut self, x0: f32, y0: f32, x1: f32, y1: f32, width: f32, color: Rgb, )

Source

pub fn stroke_line_dashed( &mut self, start: Point, end: Point, width: f32, color: Rgb, dash: &[f32], )

A line with a dash pattern ([on, off, …] in points; empty = solid).

Source

pub fn polyline( &mut self, pts: &[[f32; 2]], width: f32, color: Rgb, dash: &[f32], )

An open polyline.

Source

pub fn polygon( &mut self, pts: &[[f32; 2]], fill: Option<Rgb>, stroke: Option<(Rgb, f32)>, )

A closed polygon, filled and/or stroked.

Source

pub fn circle( &mut self, cx: f32, cy: f32, r: f32, fill: Option<Rgb>, stroke: Option<(Rgb, f32)>, )

A circle approximated by four cubic Béziers.

Source

pub fn text( &mut self, x: f32, y: f32, size: f32, font: Font, color: Rgb, text: &str, )

Text with its baseline starting at (x, y).

Source

pub fn text_rotated( &mut self, origin: Point, size: f32, font: Font, color: Rgb, text: &str, angle: f32, )

Text rotated by angle radians (clockwise on the page, like the y-down coordinate system) about its baseline origin.

Source

pub fn image_rgba( &mut self, destination: Rect, rgba: &[u8], pixel_size: [u32; 2], )

Draws an RGBA image (pw×ph pixels, row-major, straight alpha) into the box (x, y, w, h). Malformed or oversized buffers are ignored.

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

Source§

type Output = T

Should always be Self
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.