Skip to main content

DForge — Forge your documents from your terminal.

A unified, offline-first Python CLI for all your document processing needs.


Installation

pip install dforge

External Dependencies

Tool Purpose Install
Tesseract OCR OCR engine Install guide
Ghostscript PDF compression ghostscript.com
Pandoc Document conversion pandoc.org
Poppler PDF → image (pdf2image) apt install poppler-utils / brew install poppler

Quick Reference

PDF Operations

# Merge PDFs
dforge merge a.pdf b.pdf c.pdf -o merged.pdf

# Split into pages
dforge split report.pdf

# Compress (uses Ghostscript)
dforge compress large.pdf --preset ebook

# Rotate pages
dforge rotate file.pdf 90

# Extract page range
dforge pages file.pdf 1-5

# Watermark
dforge watermark file.pdf logo.png

# Encrypt / Decrypt
dforge encrypt file.pdf
dforge decrypt protected.pdf

OCR

# OCR an image
dforge ocr scan.png

# OCR a PDF
dforge ocr scan.pdf

# Output as JSON or Markdown
dforge ocr scan.pdf --fmt json
dforge ocr scan.pdf --fmt md

# Multi-language OCR
dforge ocr scan.png --lang eng+hin

# Make a scanned PDF searchable
dforge searchable scan.pdf

# Batch OCR an entire folder
dforge batch-ocr invoices/

Document Conversion

# Convert DOCX → PDF
dforge convert report.docx pdf

# Convert Markdown → HTML
dforge convert notes.md html

# Combine images into a PDF
dforge img2pdf scans/

# Export PDF pages as images
dforge pdf2img report.pdf --dpi 300 --fmt png

Content Extraction

# Extract text
dforge text report.pdf

# Extract embedded images
dforge images report.pdf

# Show / save metadata
dforge metadata report.pdf
dforge metadata report.pdf -o meta.json

# Extract tables
dforge tables invoice.pdf --fmt xlsx
dforge tables invoice.pdf --fmt csv
dforge tables invoice.pdf --fmt json

Image Processing

# Enhance (contrast + sharpness)
dforge enhance scan.png

# Fix skewed scans
dforge deskew scan.png

# Remove noise
dforge denoise scan.png

# Resize
dforge resize photo.png --width 800
dforge resize photo.png --scale 0.5

# Full OCR preprocessing pipeline
dforge preprocess scan.png

Batch Processing

# Batch OCR with 8 workers
dforge batch ./documents --ocr --workers 8

# Batch compress
dforge batch ./pdfs --compress

# Batch convert to markdown
dforge batch ./docs --convert md

Watch Mode

# Auto-OCR new files dropped into a folder
dforge watch ./incoming --ocr

# Auto-make-searchable
dforge watch ./scans --searchable

# Auto-compress
dforge watch ./uploads --compress

Project Structure

dforge/
├── cli.py           ← Typer CLI entry point
├── config.py        ← Global configuration
├── utils.py         ← Shared utilities
├── pdf/
│   └── operations.py  ← merge, split, compress, rotate, pages, watermark, encrypt, decrypt
├── ocr/
│   └── engine.py      ← ocr_image, ocr_pdf, make_searchable_pdf, batch_ocr
├── convert/
│   └── converter.py   ← convert, images_to_pdf, pdf_to_images
├── extract/
│   └── extractor.py   ← extract_text, extract_images, extract_metadata, extract_tables
├── image/
│   └── processor.py   ← enhance, deskew, denoise, resize, preprocess_for_ocr
├── batch/
│   └── processor.py   ← parallel batch processing
└── watch/
    └── watcher.py     ← watchdog-based directory monitor

Supported Formats

Category Formats
Input documents PDF, DOCX, ODT, MD, HTML, TXT, RST, EPUB
Input images PNG, JPG/JPEG, TIFF/TIF, BMP, WebP
OCR output TXT, JSON, Markdown
Table export CSV, XLSX, JSON
Image export PNG, JPEG, TIFF

License

MIT License — DForge Contributors

Release files for dforge-cli 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dforge-cli 1.0.4
File Size Uploaded
dforge_cli-1.0.4.tar.gz 28.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dforge-cli 1.0.4
File Interpreter ABI Platform
dforge_cli-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 68.4 kB

Release files / dforge_cli-1.0.4.tar.gz

Download URL dforge_cli-1.0.4.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1200b3ef5f67f16793b82b22e12e3e3373c8acaa168bf25affadd016d15be68e
BLAKE2b-256 checksum
How to use checksums
b3a6beffda5cfcb06e20989c1669c40bfa279f2e4c957491f39f9f83930b83dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.

Transparency log

Release files / dforge_cli-1.0.4-py3-none-any.whl

Download URL dforge_cli-1.0.4-py3-none-any.whl
Size 39.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6dd0e90da69cd4b912987176b2a38b6213d0ceee8cf92934a257a02137a93bc6
BLAKE2b-256 checksum
How to use checksums
722729e34fcf7f1bb3b3d7732ae3bcf2c14c2813caf79e0288abe8434b3c96f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page