New Tool Radar

OCR & Text Layers

How to Skip Pages That Already Have Text with OCRmyPDF

Use OCRmyPDF's skip-text mode on a mixed PDF so pages with real text are left alone and only the scanned pages get OCR.

Schematic illustration of OCRmyPDF skip-text: pages 1 and 3 pass through unchanged while page 2 gains a searchable layer.

OCRmyPDF’s manual says –skip-text skips OCR on any pages that already contain text but includes them in the final output, which is useful for PDFs that mix text pages, image pages and previously OCRed pages.

Use the practice file

A practice document, practice-mixed.pdf. The file is fictional.

Page Content
1 Born-digital text page, 10 lines
2 Scanned image page, including the word “harvest”
3 Born-digital text page, 6 lines

Page 2 is the check page: the word “harvest” appears there once, on the scanned page.

Check skip-text

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. Check the text pages first

Try to select a word on pages 1 and 3.

Expected result: Both pages select cleanly, confirming they already have text.

2. Run OCR with –skip-text

Run ocrmypdf –skip-text practice-mixed.pdf out.pdf.

Expected result: OCRmyPDF OCRs page 2 and passes pages 1 and 3 through.

3. Select the word

In out.pdf, drag across “harvest” on page 2.

Expected result: “harvest” highlights exactly.

4. Check the text pages are unchanged

Copy a paragraph from page 1 of out.pdf and compare it with the original.

Expected result: The paragraph is identical, with no reflow or changed characters.

Verdict table

Check Expected result Pass?
Check the text pages first Both pages select cleanly, confirming they already have text. —
Run OCR with –skip-text OCRmyPDF OCRs page 2 and passes pages 1 and 3 through. —
Select the word “harvest” highlights exactly. —
Check the text pages are unchanged The paragraph is identical, with no reflow or changed characters. —

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

  • Skip-text protects good pages from being rasterised: without it, a re-OCR can degrade text that was already perfect.
  • 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

See all