New Tool Radar

OCR & Text Layers

How to Preview OCR Text with an OCRmyPDF Sidecar Before Saving a PDF

Write OCRmyPDF's sidecar text to standard output to preview recognition quality before committing to a full PDF.

Schematic illustration of an OCRmyPDF sidecar preview: the recognised text prints to the terminal and the errors are visible before any PDF is written.

OCRmyPDF’s manual says –sidecar generates sidecar text files containing the same text Tesseract recognised, and that setting the file to ‘-‘ writes the sidecar to stdout — a convenient way to preview OCR quality.

Use the practice file

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

Page Content
1 Clean scan, 8 lines
2 Noisy scan, 8 lines, including the word “harvest”
3 Notes page

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

Check the sidecar preview

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. Preview page 2 to stdout

Run ocrmypdf –pages 2 –sidecar – –output-type none practice-sidecar.pdf out.pdf and read the printed text.

Expected result: The recognised text for page 2 prints in the terminal.

2. Search the preview

Look for “harvest” in the printed text.

Expected result: “harvest” appears once in the preview.

3. Count the errors

Compare the preview with the visible page.

Expected result: Note every misread word; the preview shows quality before any PDF is written.

4. Decide on the full run

If the preview is clean, run the full OCR; if not, fix the scan first.

Expected result: The decision follows from the preview, not from the finished file.

Verdict table

Check Expected result Pass?
Preview page 2 to stdout The recognised text for page 2 prints in the terminal. —
Search the preview “harvest” appears once in the preview. —
Count the errors Note every misread word; the preview shows quality before any PDF is written. —
Decide on the full run The decision follows from the preview, not from the finished file. —

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

  • A sidecar preview is the cheapest quality check available: it shows the recognition without writing a PDF you then have to inspect.
  • 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