OCRmyPDF’s manual says –rotate-pages automatically rotates pages based on detected text orientation, and that –rotate-pages-threshold sets the confidence needed before a page is rotated.
Use the practice file
A practice document, practice-sideways.pdf. The file is fictional.
| Page | Content |
|---|---|
| 1 | Upright page, 8 lines |
| 2 | Sideways page, rotated 90 degrees, including the word “harvest” |
| 3 | Upside-down page, rotated 180 degrees |
Page 2 is the check page: the word “harvest” appears there once, on a sideways page.
Check auto-rotation
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 OCR without rotation
Run ocrmypdf practice-sideways.pdf out1.pdf and copy page 2.
Expected result: The sideways page produces garbled or missing text.
2. Run OCR with –rotate-pages
Run ocrmypdf –rotate-pages practice-sideways.pdf out2.pdf.
Expected result: OCRmyPDF detects the orientation and rotates the pages.
3. Select the word
In out2.pdf, drag across “harvest” on page 2.
Expected result: “harvest” highlights exactly, on an upright page.
4. Check the upside-down page
Copy page 3 of out2.pdf.
Expected result: Page 3 also reads upright, with its text in order.
Verdict table
| Check | Expected result | Pass? |
|---|---|---|
| Run OCR without rotation | The sideways page produces garbled or missing text. | — |
| Run OCR with –rotate-pages | OCRmyPDF detects the orientation and rotates the pages. | — |
| Select the word | “harvest” highlights exactly, on an upright page. | — |
| Check the upside-down page | Page 3 also reads upright, with its text in order. | — |
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
- Auto-rotation needs enough text to detect orientation: a page with one line may not rotate, so check each page rather than trusting the batch.
- 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.
