Add page numbers
pdf_page_numbersAdd page numbers, headers, and footers to PDFs with custom formats, positions, page ranges, and cover skipping. Numbers stay upright on rotated pages.
Instructions
Add page numbers to a PDF, plus an optional header and footer line. Format tokens: {n}, {total}, {date}, {filename} (e.g. "Page {n} of {total}", "{n} / {total}", "- {n} -"). Choose the corner/edge, start number, how many leading pages to skip (e.g. a cover), a page range, font, size, colour and margin. Numbers stay upright on rotated pages. Web version: https://s3eidat.github.io/pdf-page-numbers/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | Text for {date}. Default: today in the server locale. | |
| file | Yes | The PDF: a local file path (absolute, or relative to the server's --root) or base64 data (raw or a data: URI). | |
| font | No | Helvetica | |
| size | No | Text size in points. Default 10. | |
| skip | No | Leave this many first pages without a number (e.g. 1 for a cover). Default 0. | |
| color | No | Colour as hex "#rrggbb". Default #333333. | #333333 |
| pages | No | Pages to number: 1-based list like "1-3, 5, 8-" ("5-" = to the end, "-3" = first three, "3-1" = reversed). Also "all", "odd", "even", "last". Empty = all pages. | |
| start | No | Number of the first numbered page. Default 1. | |
| footer | No | Optional footer text on numbered pages (tokens allowed). | |
| format | No | Number format with {n}, {total}, {date}, {filename}. Default "Page {n} of {total}". Empty = no number (header/footer only). | Page {n} of {total} |
| header | No | Optional header text on numbered pages (tokens allowed). | |
| margin | No | Distance from the page edge in points. Default 28. | |
| output | No | Where to write the result: a file path, or a folder ending in "/". Default: the server output folder (a temp folder unless --out-dir is set). | |
| position | No | Where the number goes: t/b = top/bottom, l/c/r = left/centre/right. Default "bc". | bc |
| footerAlign | No | Footer alignment: l, c or r. | c |
| headerAlign | No | Header alignment: l, c or r. | c |
| returnBase64 | No | Also return the output as base64 in the result (only for small files). Default false. |