> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spoolpdf.nandra.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Layout

> Paper size, single page, margins, header, and footer.

## Paper

Named sizes: `A0`–`A6`, `Letter`, `Legal`, `Tabloid`, `Ledger` (default `A4`). Custom: `"210mmx297mm"` or `11x17` (inches when units are omitted). Or pair `paper_width` / `paper_height`.

Single scrolling page: `"format": "1024xauto"` (unitless width is CSS pixels, ÷96 → inches) or `"single_page": true`. Do not combine with `pages`.

```json theme={null}
{"html": "<div id=\"app\">…</div>", "format": "1024xauto"}
```

## Margins, header, footer

Header/footer HTML supports only the `page` and `total` placeholders (double curly braces). No other tokens are rewritten.

```bash theme={null}
curl -sS -o letter.pdf \
  -X POST "$SPOOLPDF_BASE_URL/v1/render" \
  -H "Authorization: Bearer $SPOOLPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<main><h1>Letter</h1></main>",
    "margin": {"top":"24mm","right":"16mm","bottom":"24mm","left":"16mm"},
    "header": {"html":"<div style=\"font-size:10px\">Acme Co</div>","height":"12mm"},
    "footer": {"html":"<div style=\"font-size:10px\">Page {{page}} / {{total}}</div>","height":"12mm"}
  }'
```

`print_background` includes CSS backgrounds. `landscape` rotates the page. `scale` / `zoom` (alias) defaults to `1`.
