Struct wkhtmltopdf::pdf::PdfBuilder [−][src]
pub struct PdfBuilder { /* fields omitted */ }
High-level builder for generating PDFs (initialized from PdfApplication
)
Implementations
impl PdfBuilder
[src]
impl PdfBuilder
[src]pub fn page_size(&mut self, page_size: PageSize) -> &mut PdfBuilder
[src]
The paper size of the output document (default A4)
pub fn margin<M: Into<Margin>>(&mut self, margin: M) -> &mut PdfBuilder
[src]
Size of the page margins (default 10mm on all sides)
Note: Into<Margin>
is also implement for tuples of Margin elements
to provide CSS-like shorthand for setting each margin
pub fn orientation(&mut self, orientation: Orientation) -> &mut PdfBuilder
[src]
The orientation of the output document (default portrait)
pub fn dpi(&mut self, dpi: u32) -> &mut PdfBuilder
[src]
What dpi should we use when printin (default 72)
pub fn image_quality(&mut self, image_quality: u32) -> &mut PdfBuilder
[src]
JPEG image compression quality in percentage (default 94)
pub fn title(&mut self, title: &str) -> &mut PdfBuilder
[src]
Title of the output document (default none)
pub fn outline(&mut self, outline_depth: Option<u32>) -> &mut PdfBuilder
[src]
Enabled generating an outline (table of contents) in the sidebar with a specified depth (default 4)
Note: despite being a documented in wkhtmltopdf, the outline depth is not currently configurable due to this upstream issue. However, it can enable and disable the outline, and when the upstream issue is resolved, this method will be updated to also set the outline depth.
pub unsafe fn global_setting<S: Into<Cow<'static, str>>>(
&mut self,
name: &'static str,
value: S
) -> &mut PdfBuilder
[src]
&mut self,
name: &'static str,
value: S
) -> &mut PdfBuilder
Set a global setting not explicitly supported by the PdfBuilder
Safety
Unsafe because values not supported by wkhtmltopdf can cause undefined behavior
pub unsafe fn object_setting<S: Into<Cow<'static, str>>>(
&mut self,
name: &'static str,
value: S
) -> &mut PdfBuilder
[src]
&mut self,
name: &'static str,
value: S
) -> &mut PdfBuilder
Set an object setting not explicitly supported by the PdfBuilder
Safety
Unsafe because values not supported by wkhtmltopdf can cause undefined behavior
pub fn build_from_url<'a, 'b>(&'a mut self, url: Url) -> Result<PdfOutput<'b>>
[src]
Build a PDF using a URL as the source input
Example
let mut pdf_app = PdfApplication::new().expect("Failed to init PDF application"); let mut pdfout = pdf_app.builder() .build_from_url("https://www.rust-lang.org/en-US/".parse().unwrap()) .expect("failed to build pdf");
This method should be safe if using only safe builder methods, or if usage
of unsafe
methods (e.g. adding custom settings) is properly handled by wkhtmltopdf
pub fn build_from_path<'a, 'b, P: AsRef<Path>>(
&'a mut self,
path: P
) -> Result<PdfOutput<'b>>
[src]
&'a mut self,
path: P
) -> Result<PdfOutput<'b>>
Build a PDF using the provided HTML from a local file
Example
let mut pdf_app = PdfApplication::new().expect("Failed to init PDF application"); let mut pdfout = pdf_app.builder() .build_from_path("/path/to/static/index.html") .expect("failed to build pdf");
This method should be safe if using only safe builder methods, or if usage
of unsafe
methods (e.g. adding custom settings) is properly handled by wkhtmltopdf
pub fn build_from_html<'a, 'b, S: AsRef<str>>(
&'a mut self,
html: S
) -> Result<PdfOutput<'b>>
[src]
&'a mut self,
html: S
) -> Result<PdfOutput<'b>>
Build a PDF using the provided HTML source input
Example
let mut pdf_app = PdfApplication::new().expect("Failed to init PDF application"); let html = r#"foo<b>bar</b>"#; let mut pdfout = pdf_app.builder() .build_from_html(&html) .expect("failed to build pdf");
This method should be safe if using only safe builder methods, or if usage
of unsafe
methods (e.g. adding custom settings) is properly handled by wkhtmltopdf
pub fn global_settings(&self) -> Result<PdfGlobalSettings>
[src]
Use the relevant settings to construct a low-level instance of PdfGlobalSettings
pub fn object_settings(&self) -> Result<PdfObjectSettings>
[src]
Use the relevant settings to construct a low-level instance of PdfObjectSettings
Trait Implementations
impl Clone for PdfBuilder
[src]
impl Clone for PdfBuilder
[src]fn clone(&self) -> PdfBuilder
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for PdfBuilder
impl RefUnwindSafe for PdfBuilder
impl Send for PdfBuilder
impl Send for PdfBuilder
impl Sync for PdfBuilder
impl Sync for PdfBuilder
impl Unpin for PdfBuilder
impl Unpin for PdfBuilder
impl UnwindSafe for PdfBuilder
impl UnwindSafe for PdfBuilder