CORE
PDF options
Tune page size, orientation, margins and more with the pdf object on any render request.
The pdf object
Add a pdf object to your request to control how the page is printed. These map to the underlying Chromium print options, so behavior matches Chrome's "Print to PDF".
{
"html": "<h1>Landscape report</h1>",
"pdf": {
"format": "A4",
"landscape": true,
"printBackground": true,
"margin": { "top": "20mm", "bottom": "20mm", "left": "15mm", "right": "15mm" },
"scale": 1
}
}Options
| Option | Type | Default | Description |
|---|---|---|---|
| format | string | "A4" | Paper size — "A4", "Letter", "Legal", "A3", etc. Ignored if width/height are set. |
| landscape | boolean | false | Render in landscape orientation. |
| printBackground | boolean | true | Print background colors and images (CSS backgrounds). |
| margin | object | small default | Page margins: { top, bottom, left, right } as CSS lengths ("20mm", "1in", "0"). |
| scale | number | 1 | Scale of the rendered content, 0.1–2. |
| width / height | string | — | Explicit paper dimensions (e.g. "210mm") — overrides format. |
Defaults
Omit the pdf object and you get A4 with backgrounds printed (printBackground: true) — the right default for invoices and documents. Set only the options you want to change; the rest keep their defaults.