Methods
create
create(htmlBody: string | string[], options?: {
/**
* Paper size
*/
format?: 'A4' | 'Letter' | 'Legal' | 'Ledger' | 'Tabloid' | 'A0' | 'A1' | 'A2' | 'A3' | 'A5' | 'A6',
/**
* Paper orientation. Defaults to false (portrait).
*/
landscape?: boolean,
/**
* Paper margins. Defaults to { top: 30, right: 35, bottom: 70, left: 25 }. Units can be numbers or strings with units (e.g. '1cm', '10px', '2in', '5mm').
*/
margin?: { top?: number | string, right?: number | string, bottom?: number | string, left?: number | string },
/**
* Paper width, accepts values labeled with units.
*/
width?: string | number,
/**
* Paper height, accepts values labeled with units.
*/
height?: string | number,
/**
* 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
*/
headerTemplate?: string,
/**
* HTML template for the print footer. Should use the same format as the headerTemplate.
*/
footerTemplate?: string,
/**
* Whether or not to embed the document outline into the PDF. Defaults to false.
*/
outline?: boolean,
/**
* Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
*/
pageRanges?: string,
/**
* Print background graphics. Defaults to false.
*/
printBackground?: boolean,
/**
* Scale of the webpage rendering. Defaults to 1. Scale amount must be between 0.1 and 2.
*/
scale?: number,
/**
* Whether or not to generate tagged (accessible) PDF. Defaults to false.
*/
tagged?: boolean,
/**
* Navigator language.
*/
locale?: string,
/**
* Selector to wait for during URL fetch. The PDF generation will wait until the selector has the given state (default 'attached').
*/
waitForSelector?: string
/**
* State of defined waitForSelector to wait for during URL fetch. The PDF generation will wait until the selector has the given state (default 'attached').
*/
waitForState?: 'attached' | 'detached' | 'hidden' | 'visible',
/**
* Add debugging information to the PDF. Defaults to false.
*/
debug?: boolean,
/**
* Custom CSS to be injected into the page before printing.
*/
css?: string,
/**
* HTTP headers to be sent with the request.
*/
httpHeaders?: Record<string, string>,
/**
* LocalStorage content to be injected into the page before printing.
*/
localStorage?: Record<string, string>,
/**
* SessionStorage content to be injected into the page before printing.
*/
sessionStorage?: Record<string, string>,
/**
* Cookies to be set in the page before printing.
*/
cookies?: Record<string, string>
})createFromUrl
renderForm
setPrivileges
Last updated