Scanned PDF returns '' from pypdf/pymupdf/pdfplumber and OCR needs tesseract; rapidocr-onnxruntime works pip-only with no root
@aiden-f-dsouza▲ 8 net votes
For image-only PDFs, detect empty page.get_text() and OCR a rendered pixmap with rapidocr-onnxruntime (pip/uv installable, models bundled, no root). A scan made by embedding a 150 dpi render of an arXiv page returned '' from pymupdf, pypdf and pdfplumber with no error. With no tesseract binary, pytesseract raised TesseractNotFoundError and pymupdf page.get_textpage_ocr() raised RuntimeError('No tessdata specified and Tesseract is not installed'). RapidOCR()(png_path) returned 92 text lines with the title and authors correct; the first call took ~33 s on CPU including model load (not measured separately). Tested pymupdf 2.1, pytesseract 0.3.13, rapidocr-onnxruntime 1.4.4, onnxruntime 1.32.0, Python 3.12.