Metadata-Version: 2.4
Name: pdfworkbench
Version: 1.0.0
Summary: A toolbox for common PDF operations with a FastAPI web UI and a CLI.
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.110
Requires-Dist: uvicorn[standard]>=0.29
Requires-Dist: pypdf>=4.2
Requires-Dist: pillow>=10.0
Requires-Dist: python-multipart>=0.0.9
Requires-Dist: jinja2>=3.1
Requires-Dist: pytesseract>=0.3.13
Requires-Dist: pymupdf>=1.24

# PDFworkbench

A small toolbox for common PDF tasks with **two** interfaces:

1. **Web UI** — a dark-mode FastAPI app (merge, split, rotate, compress, extract text).
2. **CLI** — e.g. `pdfworkbench -merge --dir <directory_name>` merges every PDF in a folder.

## Requirements

- Python 3.10+

## Install

```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install pdfworkbench
```

For local development from a checkout, use an editable install instead:

```powershell
pip install -e .
```

## Run the web UI

```powershell
pdfworkbench-web
```

Then open http://127.0.0.1:8098 in your browser. Optional flags:

```powershell
pdfworkbench-web --host 0.0.0.0 --port 8098 --reload
```

The UI is also available during development with `python main.py`.

## Command line

The CLI is available through the installed `pdfworkbench` command:

```powershell
# Merge every PDF in a directory into one file (writes <dir>/merged.pdf)
pdfworkbench -merge --dir .\invoices

# Same, but recurse into sub-folders and choose the output name
pdfworkbench -merge --dir .\invoices --recursive --output all.pdf

# Merge specific files in order
pdfworkbench -merge --input a.pdf b.pdf c.pdf --output combined.pdf

# Split a PDF into one file per page
pdfworkbench -split --input big.pdf

# Rotate all pages
pdfworkbench -rotate --input scan.pdf --degrees 90

# Compress a PDF
pdfworkbench -compress --input scan.pdf

# Extract text from every page into scan.txt
pdfworkbench -extract --input scan.pdf

# Extract text from scanned pages with OCR
pdfworkbench -extract --input scan.pdf --ocr
```

For local development from a checkout, use `python main.py` with the same
operation flags.

OCR requires the Tesseract executable to be installed and available on your
PATH. The Python package installs the OCR integration and PDF renderer, but not
the Tesseract executable itself.

## Project layout

```
pdftoolbox/
├── main.py                  # entry point: web UI or CLI dispatch
├── pyproject.toml           # packaging + `pdfworkbench` console scripts
└── pdftoolbox/
    ├── operations.py        # core PDF logic (shared by CLI + web)
    ├── cli.py               # command line interface
    └── web/
        ├── app.py           # FastAPI application
        ├── templates/index.html
        └── static/          # style.css, script.js
```

All processing happens locally — files are never uploaded to a third-party server.
