OCRmyPDF’s manual says –force-ocr rasterizes any text or vector objects on each page, applies OCR, and saves the rastered output, rewriting the PDF. That is the last resort for a file whose text layer is unusable.
Use the practice file
A practice document, practice-vector-broken.pdf. The file is fictional.
| Page | Content |
|---|---|
| 1 | Vector page whose text copies as gibberish, including the visible word “harvest” |
| 2 | Vector page with a broken table |
| 3 | Notes page, plain text |
Page 1 is the check page: the visible word is “harvest” but copying gives gibberish.
Check force-ocr
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. Prove the layer is broken
Copy the word “harvest” from page 1 and paste it into a text file.
Expected result: The pasted text is gibberish, not “harvest”.
2. Run OCR with –force-ocr
Run ocrmypdf –force-ocr practice-vector-broken.pdf out.pdf.
Expected result: OCRmyPDF rasterizes the pages and OCRs them.
3. Select the word
In out.pdf, drag across “harvest” on page 1.
Expected result: “harvest” highlights exactly.
4. Check what was lost
Compare the file size and the table on page 2 with the original.
Expected result: The output is a rasterised PDF: the text is searchable, but the crisp vector text and the selectable table are gone.
Verdict table
| Check | Expected result | Pass? |
|---|---|---|
| Prove the layer is broken | The pasted text is gibberish, not “harvest”. | — |
| Run OCR with –force-ocr | OCRmyPDF rasterizes the pages and OCRs them. | — |
| Select the word | “harvest” highlights exactly. | — |
| Check what was lost | The output is a rasterised PDF: the text is searchable, but the crisp vector text and the selectable table are gone. | — |
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
- Force-ocr destroys the vector content it replaces, so keep the original: the searchable copy is a fallback, not an upgrade.
- 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.
