New Tool Radar

AI PDF

How to Check for Blank Pages in a Scanned PDF Before Running OCR

Run OCRmyPDF with a sidecar text file and find the pages that produce no text, then look at each one to confirm it is truly blank.

Schematic with three steps: Run OCRmyPDF with a sidecar text file; Find the pages that produce no text; Look at each empty page before removing.

Scanned documents often contain blank pages from separators or empty backs of sheets. OCR wastes time on them and can even invent text from specks and shadows. Finding the blank pages first lets you remove them before the OCR run.

What you need

  • OCRmyPDF installed
  • A scanned PDF
  • A terminal
  • A PDF viewer to inspect pages

Step 1: Run OCRmyPDF with a sidecar text file

Run OCRmyPDF with the –sidecar option so it writes the recognized text to a separate text file alongside the PDF.

Step 2: Find the pages that produce no text

Open the sidecar file and find the pages with no recognized text at all. Note their page numbers.

Step 3: Look at each empty page before removing it

Open each page with no text and confirm it is truly blank. A page that looks blank but carries a faint stamp or a handwritten mark is not blank, so keep it and OCR it.

Worked example: synthetic blank-page check on a 30-page scan

The table below is a synthetic example. It shows the expected result of the sidecar review; no run was made.

Page Text in sidecar Verdict
Page 6 None Blank, remove
Page 14 None Faint stamp, keep
Page 22 None Blank, remove
Total 30 pages 2 blank pages to remove

Expected result (UNTESTED). three pages produce no text, but page 14 carries a faint stamp and must be kept, while pages 6 and 22 are truly blank and can be removed before OCR. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A page with no recognized text is not necessarily blank; it may hold handwriting or a faint mark OCR missed.
  • Removing pages changes the page numbering, so note the original numbers first.
  • OCRmyPDF can be run with options that skip blank pages, but a visual check is still needed.

Sources

See all