From d446fe592243749add568b4b0d8a1db937cadbd1 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sun, 21 Feb 2016 08:53:34 -0800 Subject: [PATCH] Fix "too few characters" reported as error by tesseract -psm 0 --- ocrmypdf/tesseract.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ocrmypdf/tesseract.py b/ocrmypdf/tesseract.py index 020540cc..414a5535 100644 --- a/ocrmypdf/tesseract.py +++ b/ocrmypdf/tesseract.py @@ -98,7 +98,8 @@ def get_orientation(input_file, language: list, timeout: float, log): return OrientationConfidence(angle=0, confidence=0.0) except CalledProcessError as e: tesseract_log_output(log, e.output, input_file) - if 'Image too large' in e.output: + if ('Too few characters. Skipping this page' in e.output or + 'Image too large' in e.output): return OrientationConfidence(0, 0) raise e from e else: