Free & open source No login · No subscription · Runs on your computer
View on GitHub →
Home / Tools / Bates Numbering
Tool 02 of 07

Bates-stamp an entire folder of PDFs in one run.

Stamps numbers like SMITH00001 on every page of every PDF, continuing across files. Set the prefix and starting number at the top of the script and run one command. Stamped copies save to a new folder; originals are never modified.

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.

No prompts or menus. You set your options (prefix, starting number, position) at the top of the script, save it, and run it. That is the whole workflow.

Setup

  1. 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.

  2. 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 reportlab
    Windows
    pip install pypdf reportlab
  3. Download the script

    Use the download button in the sidebar. Save bates_numbering.py anywhere convenient — your Desktop works fine.

Running the tool

  1. 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 page

    Save the file when you're done.

  2. 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:

    Mac
    python3 bates_numbering.py
    Windows
    python bates_numbering.py
  3. 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

ErrorFix
command not found: python3Python 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.
FileNotFoundErrorINPUT_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 textChange the POSITION setting — move the stamp to a different corner where the pages have clear margin.
Numbering restarted at 1You 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.

More tools in the kit