Skip to main content
Module

x/puppeteer_plus/mod.ts>Protocol.Page.PrintToPDFRequest

Deno port of puppeteer base on latest TypeScript source.
Go to Latest
interface Protocol.Page.PrintToPDFRequest
import { type Protocol } from "https://deno.land/x/puppeteer_plus@0.14.0/mod.ts";
const { PrintToPDFRequest } = Protocol.Page;

Properties

optional
landscape: boolean

Paper orientation. Defaults to false.

optional
displayHeaderFooter: boolean

Display header and footer. Defaults to false.

optional
printBackground: boolean

Print background graphics. Defaults to false.

optional
scale: number

Scale of the webpage rendering. Defaults to 1.

optional
paperWidth: number

Paper width in inches. Defaults to 8.5 inches.

optional
paperHeight: number

Paper height in inches. Defaults to 11 inches.

optional
marginTop: number

Top margin in inches. Defaults to 1cm (~0.4 inches).

optional
marginBottom: number

Bottom margin in inches. Defaults to 1cm (~0.4 inches).

optional
marginLeft: number

Left margin in inches. Defaults to 1cm (~0.4 inches).

optional
marginRight: number

Right margin in inches. Defaults to 1cm (~0.4 inches).

optional
pageRanges: string

Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are printed in the document order, not in the order specified, and no more than once. Defaults to empty string, which implies the entire document is printed. The page numbers are quietly capped to actual page count of the document, and ranges beyond the end of the document are ignored. If this results in no pages to print, an error is reported. It is an error to specify a range with start greater than end.

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

For example, <span class=title></span> would generate span containing the title.

optional
footerTemplate: string

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

optional
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.

optional
transferMode: ("ReturnAsBase64" | "ReturnAsStream")

return as stream (PrintToPDFRequestTransferMode enum)