Skip to main content

Center and add page numbers to PDF files

Project description

pdf-pagenum

Center page number annotations in PDF files. Repositions FreeText annotations added by macOS Preview's text function, or adds new page numbers to pages that don't have them.

Features

  • Reposition mode: find existing page number annotations and center them at the bottom of each page
  • Add mode: create new page numbers on specified pages with --add
  • Start offset: begin numbering from any page with --start N
  • Smart placement: auto-detects body content boundaries, places page numbers below content with proper margins
  • Preserves A4 dimensions: never modifies page size, accepts content overlap on tight pages
  • Landscape aware: handles both portrait and landscape orientations correctly
  • White background: page numbers have a white fill to stay readable over images

Install

pip install pdf-pagenum

Usage

# Reposition existing page numbers
pdf-pagenum ./input_folder/ ./output_folder/

# Add page numbers to all pages (starting from 1)
pdf-pagenum ./input_folder/ ./output_folder/ --add all

# Add page numbers starting from 5
pdf-pagenum ./input_folder/ ./output_folder/ --add all --start 5

# Add page numbers to pages 3 through 7 only
pdf-pagenum ./input_folder/ ./output_folder/ --add 3-7

# Add page numbers to pages 1, 3, 5, 6, 7
pdf-pagenum ./input_folder/ ./output_folder/ --add 1,3,5-7 --start 10

Requirements

  • Python >= 3.9
  • PyMuPDF >= 1.23.0
  • natsort >= 8.0.0

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf_pagenum-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf_pagenum-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file pdf_pagenum-0.1.0.tar.gz.

File metadata

  • Download URL: pdf_pagenum-0.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pdf_pagenum-0.1.0.tar.gz
Algorithm Hash digest
SHA256 80e3f0c2085877a10f201916953473b2f89811d31547dc3722bb19bdaf9af1ab
MD5 d5e972e35c35da097e1cc4ef595fc59b
BLAKE2b-256 70886fe1f26acd312a8a415766da8f07100872a15c12094fee5ca1082d1239b5

See more details on using hashes here.

File details

Details for the file pdf_pagenum-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pdf_pagenum-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pdf_pagenum-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81aac626513e59fc38cc9ee2ff2aa7086c748d4d40bef295c50c31bb88043e82
MD5 b5996f09826d6b634d5dea70eb8fb509
BLAKE2b-256 de7ba905cd4a374ee00259fb0deab986a8ea4d8575e6dc19b96d4690d27b56e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page