PDFCraft
Render option

Add a running header to every page of a PDF

HTML for the running header. Supports Chromium print classes: date, title, url, pageNumber, totalPages. Needs a top margin to be visible.

Fieldoptions.headerHtml
Typestring, up to 50000 characters
Defaultnone

What it is for

HTML drawn at the top of every page. Chromium supplies pageNumber, totalPages, date, title and url as elements you can place by class.

The trap

It is rendered in a separate document with NO access to your page’s CSS. Styles must be inline, and the default font size is tiny — set it explicitly. It also needs a top margin to live in.

Example

curl -X POST https://api.pdfcraft.dev/v1/render \
  -H "Authorization: Bearer $PDFCRAFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<h1>hello</h1>",
    "options": {
      "margin": {
        "top": "25mm",
        "bottom": "20mm"
      },
      "headerHtml": "<div style=\"font-size:9px;width:100%;text-align:center;color:#666\">Invoice 1042</div>"
    }
  }' \
  --output out.pdf

Every option

Try any of these in the playground without writing a line of code, or read the full reference.