Tesseract OCR engine implementation for OCR Bridge.
This package provides a Tesseract OCR engine that integrates with the OCR Bridge architecture. Tesseract is a popular open-source OCR engine developed by Google.
- Multiple Formats: JPEG, PNG, TIFF, PDF
- Multi-page PDFs: Automatic page splitting and merging
- Language Support: 100+ languages via Tesseract language packs
- Configurable: PSM, OEM, and DPI settings
- HOCR Output: Structured XML with bounding boxes
pip install ocrbridge-tesseractNote: Tesseract binary must be installed separately:
# Ubuntu/Debian
apt-get install tesseract-ocr tesseract-ocr-eng
# macOS
brew install tesseract
# Windows
# Download from: https://github.com/UB-Mannheim/tesseract/wikiThe engine is automatically discovered by OCR Bridge via entry points.
lang(str): Language code(s), e.g., "eng", "eng+fra" (default: "eng")psm(int): Page segmentation mode 0-13 (default: 3)oem(int): OCR engine mode 0-3 (default: 1)dpi(int): DPI for PDF conversion, 70-2400 (default: 300)
from pathlib import Path
from ocrbridge.engines.tesseract import TesseractEngine, TesseractParams
engine = TesseractEngine()
# Process with defaults
hocr = engine.process(Path("document.pdf"))
# Process with custom parameters
params = TesseractParams(
lang="eng+fra",
psm=6,
oem=1,
dpi=300
)
hocr = engine.process(Path("document.pdf"), params)