Stamp Page Numbers
stamp_page_numbersAdds page numbers to each page of a PDF, with configurable position, format, and start number. Supports tagged PDF/UA artifact wrapping and CJK fonts, preserving PDF/UA conformance.
Instructions
Stamp a page number on each page. In tagged PDFs the stamp is wrapped as an Artifact, preserving PDF/UA conformance. Formats containing CJK text need fontPath or the PDF_WRITER_FONT environment variable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | #rrggbb. Default #666666. | |
| pages | No | Pages to stamp, "1,3-5,8-" (1-based). All when omitted. Use "2-" to skip a cover page. | |
| format | No | Format. {n} = current page, {total} = total pages. Default "{n}". Examples: "- {n} -" / "{n} / {total}" / "Page {n}". Must contain {n}. | |
| margin | No | Margin from the edge (pt). Default 24. Range 0-300. | |
| startAt | No | First number to stamp. Default 1. Useful to start at 1 after skipping a cover page. | |
| fontPath | No | Font to embed (.ttf/.otf). Falls back to the PDF_WRITER_FONT environment variable, then the standard font. Required for formats containing CJK text. | |
| fontSize | No | Font size (pt). Default 9. Range 4-96. | |
| position | No | Placement. Default bottom-center. Visual position, taking page /Rotate into account. | |
| inputPath | Yes | Absolute path of the target PDF. | |
| outputPath | No | Destination file path (absolute). When omitted, a base64 string is returned instead. | |
| returnBase64 | No | When true, include a base64 string in the result in addition to saving. | |
| preserveSignatures | No | Edit a signed PDF via an incremental update (appending) without invalidating existing signatures. Default false. The original bytes are untouched, so /ByteRange holds. Changes beyond the certification (DocMDP) permission level are refused. | |
| allowBreakingSignatures | No | When the target is digitally signed (detected via /ByteRange), the default is an error. Set true to proceed, accepting that the signatures become invalid. |