A CLI tool that splits large PDFs into smaller parts. Accepts PDFs up to 300MB and produces at least 10 output files, with no single output exceeding 30MB.
- Python 3.9+
- pypdf 4.0+
pip install -r requirements.txtpython pdf_breaker.py [input.pdf] [options]Run without arguments and you'll be prompted to drop your PDF file into the terminal. You can also drag-and-drop the file onto the terminal window, or paste the file path.
# Interactive: run and drop the PDF when prompted
python pdf_breaker.py
# Drop your PDF file here: [drag file or paste path]
# Or pass the path directly
python pdf_breaker.py document.pdf
# Specify output directory
python pdf_breaker.py document.pdf --output-dir ./output
# Custom filename prefix (default is input filename stem)
python pdf_breaker.py document.pdf --prefix mydoc
# Output: mydoc_part_001.pdf, mydoc_part_002.pdf, ...| Option | Short | Description |
|---|---|---|
input |
— | PDF file path (optional; if omitted, you'll be prompted to drop the file) |
--output-dir |
-o |
Parent directory for the output folder (default: same as input file) |
--prefix |
-p |
Filename prefix for output files (default: input filename) |
Output is always written to a folder named {pdf_name}_{YYYY-MM-DD} (e.g. kunal_2025-03-19). The folder is created in the same directory as the input file, or in --output-dir if specified.
- Input: Single PDF file, max 300MB
- Output: Minimum 10 PDFs (more if needed to stay under 30MB each)
- Constraint: No output file exceeds 30MB
- Ordering: Outputs are numbered sequentially in page order (part_001 = first pages, part_002 = next, etc.)
The tool first splits the PDF into equal page chunks. If any chunk would exceed 30MB when written, it is recursively split in half until all outputs are under the limit.
- Fewer than 10 pages: Creates one PDF per page (up to 10 or fewer)
- Single page over 30MB: Writes as-is with a warning (cannot sub-split)
- Exactly 30MB chunk: Accepted (constraint is "no more than 30MB")