PDF page size, orientation and margins with CSS @page

Set A4, Letter, landscape or fully custom PDF page sizes and margins with the CSS @page rule — one style block, no API parameters needed.

Page geometry is CSS, not an API parameter — the @page rule controls size, orientation and margins:

<style>
  @page {
    size: A4;            /* or: letter, legal, A5, A3 … */
    margin: 20mm 15mm;
  }
</style>

Landscape and custom dimensions:

@page { size: A4 landscape; }
@page { size: 210mm 99mm; }   /* e.g. a DL flyer — width height */

Because it is a normal stylesheet rule, one codebase can produce different formats by swapping a single style block before calling /v1/render.

Page breaks

Control pagination with the standard fragmentation properties:

h2          { break-before: page; }   /* each chapter on a new page */
table, figure { break-inside: avoid; } /* keep blocks intact */

Documents are capped at 50 pages per render — a document that paginates beyond that is rejected with 422 too_many_pages (all limits).

Try it free

Try it free — 100 renders a month, no card — or experiment in the free browser tool.