pub struct Options {
pub input: PathBuf,
pub output: Option<PathBuf>,
pub landscape: bool,
pub background: bool,
pub wait: Option<Duration>,
pub header: Option<String>,
pub footer: Option<String>,
pub paper: Option<PaperSize>,
pub scale: Option<f64>,
pub range: Option<String>,
pub margin: Option<Margin>,
pub disable_sandbox: bool,
}
Expand description
Generate a PDF from a local HTML file using a headless chrome
Fields§
§input: PathBuf
Input HTML file.
output: Option<PathBuf>
Output file. By default, just change the input extension to PDF
landscape: bool
Use landscape mode.
background: bool
Allow print background.
wait: Option<Duration>
Time to wait in ms before printing. Examples: 150ms, 10s
header: Option<String>
HTML template for the print header.
Should be valid HTML markup with following classes used to inject printing values into
them:
date for formatted print date,
title for document title,
url for document location,
pageNumber for current page number,
totalPages for total pages in the document.
For example, <span class=title></span>
would generate span containing the title.
HTML template for the print footer. Should use the same format as the headerTemplate.
paper: Option<PaperSize>
Paper size. Supported values: A4, Letter, A3, Tabloid, A2, A1, A0, A5, A6
scale: Option<f64>
Scale, default to 1.0
range: Option<String>
Paper ranges to print, e.g. ‘1-5, 8, 11-13’
margin: Option<Margin>
Margin in inches You can define margin like this: ‘0.4’ the value is applied for all side, ‘0.4 0.4’ : first value is applied for top and bottom, second for left and right, ‘0.4 0.4 0.4 0.4’ : first value is applied for top then, right, then bottom, and last for left
disable_sandbox: bool
Disable Chrome sandbox Not recommended, unless running on docker
Implementations§
source§impl Options
impl Options
sourcepub fn background(&self) -> bool
pub fn background(&self) -> bool
Get a reference to the cli options’s background.
Get a reference to the cli options’s footer.
sourcepub fn disable_sandbox(&self) -> bool
pub fn disable_sandbox(&self) -> bool
Get a reference to the cli options’s sandbox.
Trait Implementations§
source§impl CommandFactory for Options
impl CommandFactory for Options
source§impl From<&Options> for LaunchOptions<'_>
impl From<&Options> for LaunchOptions<'_>
source§impl From<&Options> for PrintToPdfOptions
impl From<&Options> for PrintToPdfOptions
source§impl FromArgMatches for Options
impl FromArgMatches for Options
source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches ) -> Result<Self, Error>
source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches ) -> Result<(), Error>
ArgMatches
to self
.source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches ) -> Result<(), Error>
ArgMatches
to self
.