What it does
Bates Numbering stamps a sequential number — like SMITH00001, SMITH00002, SMITH00003 — on every page of every PDF in a folder. Numbering continues across files, so a 40-page document followed by a 10-page document is numbered 1–40 and then 41–50, exactly the way a production set should read.
Your originals are never modified. The script writes stamped copies into a separate output folder, so the source documents stay untouched.
Setup
-
Install Python 3 (once)
Download it free from python.org/downloads and run the installer. On Windows, check the box that says "Add Python to PATH" during installation.
-
Install the two libraries this tool needs
Open Terminal (Mac) or Command Prompt (Windows) and paste the command for your system:
Mac/usr/local/bin/pip3 install pypdf reportlabWindowspip install pypdf reportlab -
Download the script
Use the download button in the sidebar. Save bates_numbering.py anywhere convenient — your Desktop works fine.
Running the tool
-
Set your options at the top of the script
Open bates_numbering.py in any text editor. The first few lines are settings — edit each one:
# The six settings at the top of the script:
INPUT_FOLDER ← folder containing the PDFs to stamp
OUTPUT_FOLDER ← where the stamped copies go
PREFIX ← e.g. "SMITH" → SMITH00001
START_NUMBER ← usually 1, or continue a prior set
DIGITS ← 5 → 00001; 6 → 000001
POSITION ← where the stamp sits on the pageSave the file when you're done.
-
Run it
In Terminal or Command Prompt, navigate to the folder holding the script (type cd, a space, then drag the folder into the window and press Enter). Then run:
Macpython3 bates_numbering.pyWindowspython bates_numbering.py -
Check the output folder
Every PDF now has its Bates number stamped on every page, numbered continuously across the whole set. Your originals are exactly as you left them.
Common errors
| Error | Fix |
|---|---|
| command not found: python3 | Python isn't installed (or isn't on your PATH). Install it from python.org — on Windows, re-run the installer and check "Add Python to PATH." |
| No module named 'pypdf' | The libraries didn't install. Re-run the install command from Setup step 2. On a Mac, use the full /usr/local/bin/pip3 path shown above. |
| FileNotFoundError | INPUT_FOLDER points somewhere that doesn't exist. Drag the actual folder into Terminal to get its exact path, and paste that into the script. |
| Stamp overlaps existing text | Change the POSITION setting — move the stamp to a different corner where the pages have clear margin. |
| Numbering restarted at 1 | You re-ran the script with START_NUMBER = 1. To continue a prior production set, set START_NUMBER to the next number after your last stamped page. |