PPDFInvoiceAPI
DOCS/ PDF options

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

OptionTypeDefaultDescription
formatstring"A4"Paper size — "A4", "Letter", "Legal", "A3", etc. Ignored if width/height are set.
landscapebooleanfalseRender in landscape orientation.
printBackgroundbooleantruePrint background colors and images (CSS backgrounds).
marginobjectsmall defaultPage margins: { top, bottom, left, right } as CSS lengths ("20mm", "1in", "0").
scalenumber1Scale of the rendered content, 0.1–2.
width / heightstringExplicit 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.