PdfBuilder

Struct PdfBuilder 

Source
pub struct PdfBuilder<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j> {
    inner: Weak<Page>,
    args: PdfArgs<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j>,
}

Fields§

§inner: Weak<Page>§args: PdfArgs<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j>

Implementations§

Source§

impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j> PdfBuilder<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j>

Source

pub(crate) fn new(inner: Weak<Impl>) -> Self

Source

pub async fn pdf(self) -> Result<(), Arc<Error>>

Source

pub fn scale(self, x: f64) -> Self

Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2.

Display header and footer. Defaults to false.

Source

pub fn header_template(self, x: &'a str) -> Self

HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them:

  • 'date' formatted print date
  • 'title' document title
  • 'url' document location
  • 'pageNumber' current page number
  • 'totalPages' total pages in the document
Source

pub fn footer_template(self, x: &'b str) -> Self

HTML template for the print footer. Should use the same format as the headerTemplate.

Source

pub fn print_background(self, x: bool) -> Self

Print background graphics. Defaults to false.

Source

pub fn landscape(self, x: bool) -> Self

Paper orientation. Defaults to false.

Source

pub fn page_ranges(self, x: &'c str) -> Self

Paper ranges to print, e.g., ‘1-5, 8, 11-13’. Defaults to the empty string, which means print all pages.

Source

pub fn format(self, x: &'d str) -> Self

Paper format. If set, takes priority over width or height options. Defaults to ‘Letter’.

Source

pub fn width(self, x: Length<'e>) -> Self

Paper width, accepts values labeled with units.

Source

pub fn height(self, x: Length<'f>) -> Self

Paper height, accepts values labeled with units.

Source

pub fn prefer_css_page_size(self, x: bool) -> Self

Give any CSS @page size declared in the page priority over what is declared in width and height or format options. Defaults to false, which will scale the content to fit the paper size.

Source

pub fn margin(self, x: PdfMargins<'g, 'h, 'i, 'j>) -> Self

Paper margins, defaults to none.

Source

pub fn path(self, x: PathBuf) -> Self

The file path to save the PDF to. If path is a relative path, then it is resolved relative to the current working directory. If no path is provided, the PDF won’t be saved to the disk.

Source

pub fn clear_scale(self) -> Self

Source

pub fn clear_header_template(self) -> Self

Source

pub fn clear_print_background(self) -> Self

Source

pub fn clear_landscape(self) -> Self

Source

pub fn clear_page_ranges(self) -> Self

Source

pub fn clear_format(self) -> Self

Source

pub fn clear_width(self) -> Self

Source

pub fn clear_height(self) -> Self

Source

pub fn clear_prefer_css_page_size(self) -> Self

Source

pub fn clear_margin(self) -> Self

Source

pub fn clear_path(self) -> Self

Auto Trait Implementations§

§

impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j> Freeze for PdfBuilder<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j>

§

impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j> RefUnwindSafe for PdfBuilder<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j>

§

impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j> Send for PdfBuilder<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j>

§

impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j> Sync for PdfBuilder<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j>

§

impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j> Unpin for PdfBuilder<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j>

§

impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j> UnwindSafe for PdfBuilder<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j>

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.