Extract Text From a PDF With Selectable Text and Scans

If a PDF page contains both selectable text and a scanned image, extract the selectable text first. Then run optical character recognition (OCR) on the part of the image you need. In ImgWell’s PDF to Text tool, both operations run in your browser. You can review the OCR result separately before adding it to the extracted text.

Why a correct search result can hide missing text

On page 2 of a U.S. Department of Energy briefing, a White House memorandum appears as an image on the left. The quotation and date on the right are selectable text. The date, January 9, 2014, appears in both places.

The image of the memorandum includes For Immediate Release and January 9, 2014. The same date appears separately as selectable text on the right.
Two excerpts from the same page. The memorandum image is at the top, and the selectable date is below.

Here’s what we observed on that page in Chromium and WebKit.

Step What we saw
First extraction The text included January 9, 2014 from the right side. For Immediate Release was missing.
OCR on the selected region For Immediate Release appeared in a separate candidate. The page text stayed as it was.
TXT export after appending For Immediate Release appeared at the end of the page’s extracted text in the downloaded file.

Check the specific passage you need against the page image, even when a search finds a matching date or ID elsewhere on it.

Extract the text layer and OCR the missing area

Try the same file in PDF to Text. You only need to process page 2 of the briefing.

  1. Add the PDF. Open Advanced settings, enter 2 in the page range and select English for OCR. Choose TXT if you want plain text, then start extraction.

  2. Compare the text with the page. Select Review flagged pages if prompted, or open Review original and text. Find the date in the extracted text, then look for For Immediate Release in the memorandum on the left.

  3. Box the missing passage. Open Page review tools and choose Select text, number or ID. Draw a box around For Immediate Release in the memorandum image. Choose Recognize selected text.

    ImgWell’s page preview with a selection box around For Immediate Release in the memorandum on the left.
    Box the single line inside the memorandum image on the left.
  4. Review and export. Compare the candidate with the image. Append to page text adds it to the end of that page’s text. To place it in reading order, click the intended spot in the text editor and choose Insert at cursor. Check the result before downloading as TXT or Word.

    ImgWell shows For Immediate Release as a selected-text candidate with Insert at cursor and Append to page text buttons.
    Choose where the verified passage belongs before adding it to the page text.

Choose the extraction method for your page

If your page contains Start with
Selectable text only Extract the text layer and check reading order
A full-page scan Run page OCR and check important text against the image
Selectable text and an embedded scan Extract the text layer, then OCR the missing region

For IDs, dates and amounts, check every character against the original. Include the letters, decimal points or separators when drawing the box. For a table, also check that each value belongs to the right row and column. If nothing on the page can be selected, see why PDF text sometimes cannot be copied.