Appearance
PDF route body parameters
To render a PDF, set pdf under the page property:
pdf properties for PDF routes
These properties follow Puppeteer's PDFOptions type.
| Property name | Type | Description |
|---|---|---|
scale | number | Scales the rendering of the page. The value must be between 0.1 and 2. optional |
displayHeaderFooter | boolean | Whether to show the header and footer. optional |
headerTemplate | string | HTML template for the print header. See the valid HTML pattern below. optional |
footerTemplate | string | HTML template for the print footer. Has the same constraints and support for special classes as PDFOptions.headerTemplate. optional |
printBackground | boolean | Set to true to print background graphics. optional |
landscape | boolean | Whether to print in landscape orientation. optional |
pageRanges | string | Paper ranges to print, e.g. 1-5, 8, 11-13. optional |
format | PaperFormat | All the valid paper format types when printing a PDF. See all formats. optional |
width | string, number | Sets the width of paper. You can pass in a number or a string with a unit. optional |
height | string, number | Sets the height of paper. You can pass in a number or a string with a unit. optional |
margin | Margin | Sets the margin of every page. See the expected properties here optional |
preferCSSPageSize | boolean | Gives any CSS @page size declared in the page priority over the width, height, or format option. optional |
omitBackground | boolean | Hides the default white background and allows generating PDFs with transparency. optional |
Valid HTML pattern for headerTemplate and footerTemplate
It must be valid HTML (base64-encoded) and can include the following classes, which will be replaced with runtime values:
date: formatted print datetitle: document titleurl: document locationpageNumber: current page numbertotalPages: total number of pages in the document
Paper formats
| Format name | Size in inches | Size in cm | Size in feet |
|---|---|---|---|
Letter | 8.5in x 11in | 21.6cm x 27.9cm | 0.666ft x 0.917ft |
Legal | 8.5in x 14in | 21.6cm x 35.6cm | 0.666ft x 1.167ft |
Tabloid | 11in x 17in | 27.9cm x 43.2cm | 0.917ft x 1.417ft |
Ledger | 17in x 11in | 43.2cm x 27.9cm | 1.417ft x 0.917ft |
A0 | 33.1in x 46.8in | 84cm x 118.9cm | 2.757ft x 3.898ft |
A1 | 23.4in x 33.1in | 59.4cm x 84cm | 1.948ft x 2.757ft |
A2 | 16.54in x 23.4in | 42cm x 59.4cm | 1.377ft x 1.948ft |
A3 | 11.7in x 16.54in | 29.7cm x 42cm | 0.974ft x 1.377ft |
A4 | 8.27in x 11.7in | 21cm x 29.7cm | 0.689ft x 0.974ft |
A5 | 5.83in x 8.27in | 14.8cm x 21cm | 0.485ft x 0.689ft |
A6 | 4.13in x 5.83in | 10.5cm x 14.8cm | 0.344ft x 0.485ft |
Margin
| Property name | Type | Description |
|---|---|---|
top | string, number | Top margin optional |
right | string, number | Right margin optional |
left | string, number | Left margin optional |
bottom | string, number | Bottom margin optional |