Free & open source No login · No subscription · Runs on your computer
View on GitHub →
Home / Tools / PDF Merger
Tool 04 of 07

One folder in, one clean combined PDF out.

Merges every PDF in a folder into a single file, sorted alphabetically or by Bates number, with an optional table of contents showing where each document begins. The script asks you everything when it runs; no editing needed.

What it does

PDF Merger combines every PDF in a folder into a single file. You can sort the documents alphabetically or by Bates number, and optionally add a table of contents at the front listing each document and the page it starts on — the way a well-assembled exhibit binder or production volume reads.

No editing required. Unlike the Bates tool, this script asks you everything when it runs — the folder, the sort order, the output name, and whether you want a table of contents. You never open the script itself.

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 pdf_merger.py anywhere convenient.

Running the tool

  1. Start the script

    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 pdf_merger.py
    Windows
    python pdf_merger.py
  2. Answer the prompts

    The script walks you through four questions:

    # What it asks, in order:
    Folder path   ← drag the folder into the window to paste its path
    Sort order    ← a = alphabetical, b = by Bates number
    Output name   ← e.g. Production_Vol_1.pdf
    Add TOC?      ← y = table of contents at the front, n = skip
  3. Open the merged file

    The combined PDF is saved with the name you chose. If you added the table of contents, it appears as the first pages, listing every document and its starting page number.

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.
FileNotFoundErrorThe folder path you entered has a typo. Drag the folder straight into the Terminal window instead of typing the path by hand.
No PDFs found in folderThe folder contains no .pdf files at the top level — check that your documents aren't tucked inside subfolders.
EOF marker not found / read errorOne of the PDFs in the folder is corrupted. The error message names the file — move it out, re-export it from its source, and run again.

More tools in the kit