A small command line tool to convert PDF files to images and extract text. The default OCR engine is Tesseract but two Hugging Face models are also supported.
Install the Python dependencies via pip:
pip install -r requirements.txt
python pdf_ocr.py <file.pdf> --out-dir output --lang deu --engine tesseract
All pages of the PDF will be saved as JPG images in the output folder. The recognized text is printed to the console and written to output/output.txt.
This repository contains only a minimal example. Make sure tesseract and the language data you need are installed on your system.
8 commits
Python
83.4%
HTML
16.6%
A small command line tool to convert PDF files to images and extract text. The default OCR engine is Tesseract but two Hugging Face models are also supported.
Install the Python dependencies via pip:
pip install -r requirements.txt
python pdf_ocr.py <file.pdf> --out-dir output --lang deu --engine tesseract
All pages of the PDF will be saved as JPG images in the output folder. The recognized text is printed to the console and written to output/output.txt.
This repository contains only a minimal example. Make sure tesseract and the language data you need are installed on your system.
8 commits
Python
83.4%
HTML
16.6%