Skip to main content

Add Page Number to PDF

EditAdd Page Number to PDF

The Add Page Number to PDF API adds page numbers to your PDF. You send the PDF (docContent, docName), pageNumberFormat (e.g. # of {1} where # is current page and {1} is total pages), alignX and alignY, optional margins, fontSize, isBold, isItalic, skipFirstPage, and async. The API returns the PDF with page numbers added. Use the tester below to try it; more details are in the sections that follow.

Try the Add Page Number to PDF API

Quick reference

Endpoint: POST /api/v2/AddPageNumber · Required: api-key, docContent, docName, pageNumberFormat, alignX, alignY

Try it live

Use the form below to send your API key, PDF (Base64), format (e.g. "# of 1"), and position. The response is the PDF with page numbers. No code required—fill the fields and click Send request.

Loading API Tester...

Overview, parameters, and use cases

What is Add Page Number to PDF?

This endpoint adds page numbers to specified pages of a PDF. You choose the format with pageNumberFormat: use # for the current page and {1} for the total number of pages. Position is set by alignX (left, center, right) and alignY (top, middle, bottom), optional margins in mm, fontSize (8–72), isBold, isItalic, and skipFirstPage to omit numbering on the first page.

Page number format options

  • # – Placeholder for the current page number.
  • 1 – Placeholder for the total number of pages.
  • Examples: "# of {1}" → "1 of 10", "2 of 10"; "Page #" → "Page 1", "Page 2"; "# / {1}" → "1 / 10"; "- # -" → "- 1 -"; "[#/{1}]" → "[1/10]"; "(#)" → "(1)"; "#" → just "1", "2", etc.

Key features

  • FormatpageNumberFormat with # and {1} as above.
  • PositionalignX (left, center, right), alignY (top, middle, bottom), marginXinMM, marginYinMM.
  • StylingfontSize (8–72), isBold, isItalic.
  • skipFirstPage – Omit page number on the first page (e.g. for cover).
Best for

Use for reports, manuals, or any multi-page PDF that needs pagination. Combine with Add HTML Header Footer to PDF or Add Margin to PDF for consistent layout.

Prerequisites

Before using this endpoint, make sure you have:

  • A valid PDF4me API key (Get your API Key)
  • A PDF document in Base64 format or a public URL to a PDF file

Response Format

The API returns a PDF document with page numbers added according to your specifications.

Get Help