OCRmyPDF’s manual says –tesseract-oem sets Tesseract 4+ engine mode: 0 for the original engine only, 1 for neural nets LSTM only, 2 for both, and 3 for the default. The mode is a real choice, not a version number: different pages read better under different engines.
Use the practice file
A practice document, practice-oem.pdf. The file is fictional.
| Page | Content |
|---|---|
| 1 | Clean modern print, 10 lines, including the word “harvest” |
| 2 | Old typewriter page, 10 lines |
| 3 | Notes page |
Page 1 is the check page: the word “harvest” appears there once, in clean modern print.
Check the engine modes
Expected result. We checked the OCRmyPDF manual and the Tesseract manual. We did not run any tool. The checks below are what to expect if the work is done correctly; run them yourself on the practice file.
1. Run with the default mode
Run ocrmypdf –tesseract-oem 3 practice-oem.pdf out3.pdf and copy page 1.
Expected result: Count the errors on page 1.
2. Run with LSTM only
Run ocrmypdf –tesseract-oem 1 practice-oem.pdf out1.pdf and copy page 1.
Expected result: Count the errors again.
3. Run with the legacy engine
Run ocrmypdf –tesseract-oem 0 practice-oem.pdf out0.pdf and copy page 1.
Expected result: Count the errors a third time.
4. Pick the best for this document
Compare the three counts and the typewriter page.
Expected result: The mode with the fewest errors on both pages is the one to use for the full run.
Verdict table
| Check | Expected result | Pass? |
|---|---|---|
| Run with the default mode | Count the errors on page 1. | — |
| Run with LSTM only | Count the errors again. | — |
| Run with the legacy engine | Count the errors a third time. | — |
| Pick the best for this document | The mode with the fewest errors on both pages is the one to use for the full run. | — |
Related guides: How to Batch OCR a Multi-Page PDF with Consistent Settings — How to Add a Searchable Text Layer to a Scanned PDF.
Limits
- No engine mode wins on every document: the comparison has to be run on your pages, not assumed from the version number.
- Command-line OCR rewrites the file, so always work on a copy and keep the original scan untouched.
- UNTESTED — no OCR tool was run; all results above are expected results. The practice file is fictional.
Sources
- OCRmyPDF manual, “ocrmypdf(1) — add an OCR text layer to scanned PDF files” — Modes default, force, skip, redo and strip; –sidecar writes the recognized text; –pages limits OCR to chosen pages. Checked 2026-11-28.
- Tesseract manual, “tesseract(1) — command-line OCR engine” — Default language is English; -l takes 3-character ISO 639-2 codes, joined with + for several languages; –list-langs lists installed packs; –psm sets the page segmentation mode. Checked 2026-11-28.
