New Tool Radar

OCR & Text Layers

How to OCR Sparse Text in a Scanned PDF with Tesseract Page Segmentation Mode 11

Use Tesseract's sparse-text page segmentation mode on a page with scattered words, such as a diagram with labels, and check nothing is missed.

Schematic illustration of Tesseract page segmentation mode 11: all six diagram labels are found, though not in page order.

Tesseract’s –psm option tells the engine what layout to assume. The manual lists mode 11 as sparse text: find as much text as possible in no particular order. That fits a diagram with labels, a poster, or a form with scattered fields — pages where the default mode looks for blocks that are not there.

Use the practice file

A practice document, practice-sparse-text.pdf. The file is fictional.

Page Content
1 Diagram with 6 labels: “Harvest”, “Market”, “Barn”, “Field”, “River”, “Mill”
2 Poster with 4 scattered words
3 Blank page

Page 1 is the check page: the diagram has 6 labels, including “Harvest” and “Mill”.

Check mode 11 on sparse 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. Render the diagram

Render page 1 to an image at 300 dpi.

Expected result: The image holds six scattered labels.

2. Run Tesseract with –psm 11

Run tesseract diagram.png out –psm 11.

Expected result: Tesseract produces a text file.

3. Count the labels found

Search the output for each of the six labels.

Expected result: All six labels appear in the output.

4. Note the order

Read the output lines.

Expected result: The labels are not in reading order — mode 11 finds text, it does not order it, so check presence, not sequence.

Verdict table

Check Expected result Pass?
Render the diagram The image holds six scattered labels. —
Run Tesseract with –psm 11 Tesseract produces a text file. —
Count the labels found All six labels appear in the output. —
Note the order The labels are not in reading order — mode 11 finds text, it does not order it, so check presence, not sequence. —

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

  • Sparse-text mode trades order for coverage: it finds scattered words the default mode misses, but the output order is not the page order.
  • 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