puppeteer/new-docs/puppeteer.protocol.page.printtopdfrequest.md
2020-07-13 14:01:35 +01:00

3.4 KiB

Home > puppeteer > Protocol > Page > PrintToPDFRequest

Protocol.Page.PrintToPDFRequest interface

Signature:

export interface PrintToPDFRequest 

Properties

Property Type Description
displayHeaderFooter boolean Display header and footer. Defaults to false.
footerTemplate string HTML template for the print footer. Should use the same format as the headerTemplate.
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 documentFor example, <span class=title></span> would generate span containing the title.
ignoreInvalidPageRanges boolean Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. Defaults to false.
landscape boolean Paper orientation. Defaults to false.
marginBottom number Bottom margin in inches. Defaults to 1cm (~0.4 inches).
marginLeft number Left margin in inches. Defaults to 1cm (~0.4 inches).
marginRight number Right margin in inches. Defaults to 1cm (~0.4 inches).
marginTop number Top margin in inches. Defaults to 1cm (~0.4 inches).
pageRanges string Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
paperHeight number Paper height in inches. Defaults to 11 inches.
paperWidth number Paper width in inches. Defaults to 8.5 inches.
preferCSSPageSize boolean Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.
printBackground boolean Print background graphics. Defaults to false.
scale number Scale of the webpage rendering. Defaults to 1.
transferMode ('ReturnAsBase64' | 'ReturnAsStream') return as stream