Bug fix: --force-ocr should still run on pages with no images

Useful for people who want to reprocess text.

This also requires --oversample because DPI is undefined. To be fixed
in next commit.
This commit is contained in:
James R. Barlow
2016-07-27 15:06:49 -07:00
parent 8458a51860
commit 16e4d342d2
2 changed files with 32 additions and 15 deletions
+11
View File
@@ -420,6 +420,17 @@ def test_blank_input_pdf():
assert p.returncode == ExitCode.ok
def test_force_ocr_on_pdf_with_no_images(spoof_tesseract_crash):
# As a correctness test, make sure that --force-ocr on a PDF with no
# content still triggers tesseract. If tesseract crashes, then it was
# called.
p, _, err = run_ocrmypdf_env(
'blank.pdf', 'wont_be_created.pdf', '--force-ocr',
env=spoof_tesseract_crash)
assert p.returncode == ExitCode.child_process_error, err
assert not os.path.exists(_outfile('wontwork.pdf'))
def test_french(spoof_tesseract_cache):
p, out, err = run_ocrmypdf_env(
'francais.pdf', 'francais.pdf', '-l', 'fra', env=spoof_tesseract_cache)