Skip to content

VM Code SDK v2 / PagePdfOptions

Type alias: PagePdfOptions

PagePdfOptions: object

Type declaration

displayHeaderFooter?

optional displayHeaderFooter: boolean

Display header and footer. Defaults to false.

filename?

optional filename: string

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.

footerTemplate?

optional footerTemplate: string

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

format?

optional format: string

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

headerTemplate?

optional headerTemplate: string

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

height?

optional height: string | number

Paper height, accepts values labeled with units.

landscape?

optional landscape: boolean

Paper orientation. Defaults to false.

margin?

optional margin: object

Paper margins, defaults to none.

margin.bottom?

optional bottom: string | number

Bottom margin, accepts values labeled with units. Defaults to 0.

margin.left?

optional left: string | number

Left margin, accepts values labeled with units. Defaults to 0.

margin.right?

optional right: string | number

Right margin, accepts values labeled with units. Defaults to 0.

margin.top?

optional top: string | number

Top margin, accepts values labeled with units. Defaults to 0.

media?

optional media: "screen" | "print"

set media type to print or screen.

pageRanges?

optional pageRanges: string

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

preferCSSPageSize?

optional preferCSSPageSize: boolean

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.

printBackground?

optional printBackground: boolean

Print background graphics. Defaults to false.

scale?

optional scale: number

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

width?

optional width: string | number

Paper width, accepts values labeled with units.