Skip to content

ckryptickunal/PDF-Breaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

PDF Breaker

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.

Requirements

  • Python 3.9+
  • pypdf 4.0+

Installation

pip install -r requirements.txt

Usage

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

Examples

# 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, ...

Options

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 Folder

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.

Behavior

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

Edge Cases

  • 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")

About

To break big pdf into smaller chunks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages