PDFCraft
Render option

Add page numbers to a PDF footer

HTML for the running footer. Same classes as headerHtml; needs a bottom margin.

Fieldoptions.footerHtml
Typestring, up to 50000 characters
Defaultnone

What it is for

The same mechanism as headerHtml, at the bottom. This is where page numbering belongs.

The trap

Same two traps: inline styles only, and it needs a bottom margin. The class names are exact — <span class="pageNumber"></span> and <span class="totalPages"></span>, and a typo produces an empty footer rather than an error.

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": {
        "bottom": "20mm"
      },
      "footerHtml": "<div style=\"font-size:9px;width:100%;text-align:center;color:#666\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>"
    }
  }' \
  --output out.pdf

Every option

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