endpoint
Add page numbers
POST /api/v1/add-page-numbers
Stamp page-number labels with custom templates and styles (arabic, roman, alpha).
credits: 1returns: application/pdf
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | multipart file | required | Source PDF. |
| template | string | optional | {n}, {total}, {roman} tokens.default: {n} of {total} |
| position | enum | optional | top/bottom + left/center/right.default: bottom-center |
| fontSize | integer | optional | Font size in points.default: 10 |
| marginPt | integer | optional | Distance from edge.default: 20 |
| startAt | integer | optional | First page number.default: 1 |
| style | "arabic" | "roman" | "romanLower" | "alpha" | "alphaLower" | optional | Number style.default: arabic |
Examples
curl
curl -X POST https://api.snappdf.au/api/v1/add-page-numbers \
-H "Authorization: Bearer $SNAPPDF_API_KEY" \
-F "file=@doc.pdf" -F "template=Page {n} / {total}" -F "style=arabic" \
-o numbered.pdfJavaScript
await snap.pdf.addPageNumbers({ file: bytes, template: 'Page {n} / {total}' });Python
snap.pdf.add_page_numbers(file=bytes, template="Page {n} / {total}")PHP
$snap->pdf->addPageNumbers(file: $bytes, template: 'Page {n} / {total}');Ruby
snap.pdf.add_page_numbers(file: bytes, template: 'Page {n} / {total}')Go
client.AddPageNumbers(ctx, &snappdf.AddPageNumbersInput{File: bytes, Template: "Page {n} / {total}"})