Docuboxer
By ··Updated: ·7 min read

How to Extract Text From a Scanned PDF (OCR)

How to tell if a PDF already has text and, if it is a scan, which free OCR options exist: Live Text, Google Drive and Tesseract, with their trade-offs.

There are two ways to get the text out of a scanned PDF. If the PDF already has a text layer, you don't need OCR: extract the text from the PDF directly. If the pages are images, you need an OCR program, and the free options include Apple's Live Text, Google Drive and Tesseract. This guide explains how to tell the two cases apart, what each option does with your file and what helps recognition come out right.

First check whether the PDF already has text

A PDF that comes out of a scanner or from photos of a sheet stores each page as an image. One exported from Word or from an invoicing system usually carries real text. The difference shows when you search for a word with Ctrl+F: if it is found, there is text. If not, it is an image.

Docuboxer's PDF text extraction tool does that check for you. It extracts the text from the pages that have it and lists the pages with no extractable text, because it does not do OCR and does not invent the content of what it cannot read. The guide on why you can't copy text from a PDF covers the other causes, such as author restrictions.

What OCR actually does

A scanned page is a photograph. The file contains no letters, only pixels arranged to look like letters. OCR (optical character recognition) analyzes those pixels, identifies the characters they form and rebuilds the text. The result depends on image quality more than on anything else, which is why you should always review it before using it in a contract or an invoice.

Free options for running OCR

  • Live Text (Apple): on iPhone and iPad it recognizes the text in photos and images and lets you copy it. According to Apple it uses on-device intelligence. It needs an iPhone XS, XR or later running iOS 15 or later, per Apple's help page.
  • Camera apps with text recognition: some, such as Google Lens on Android, let you copy the text from a photo or a screenshot. Check the privacy policy of the one you use before giving it a sensitive document.
  • Google Drive: upload the scanned PDF and open it with Google Docs, and the text is recognized during the conversion. It is free, but the document goes through Google's servers. According to its Drive help, the file must be 2 MB or smaller, the text at least 10 pixels high and the document right side up; if the image is rotated, turn it before uploading.
  • Tesseract: an open-source OCR engine under the Apache 2.0 license. You install it and it runs on your own machine, from the command line (there is project documentation). It is the local, scriptable option for many files.

The workflow is the same everywhere: load the document, pick the language, wait for processing and copy the text. Docuboxer does not have an OCR tool yet. It is not part of the suite for now.

How to improve recognition accuracy

The Tesseract documentation on image quality collects the practices that matter most, and they apply to any engine:

  • Resolution: Tesseract works best on images of at least 300 DPI. If you scan, set the scanner to that.
  • Skew: a badly tilted page reduces line recognition quality. Straighten it first.
  • Borders: dark scanner borders can be read as characters, so crop them out. Cropping right up to the text without leaving a small margin can also cause problems.
  • Language: tell the engine the document's language. Tesseract publishes trained data per language, Spanish among them.

Why OCR is a privacy decision

People run OCR on contracts, medical records, bank statements and identity documents. These are among the most sensitive files anyone owns, and recognition means handing the complete, unredacted page to the program that processes it. With an option that runs on your own machine, like Tesseract or Live Text, the document never reaches someone else's server. With one that uploads the file, like Google Drive, it does. Choose according to what is on the paper.

If the PDF has many pages

It helps to split the PDF and process only the pages you need, or to export the pages as images so you can feed them one by one to an app that only accepts images. If the final result has to be a PDF again, converting images to PDF and merging PDF files cover that part.

Check whether your PDF already has text

Extract the text in your browser, and it tells you which pages are images.

Extract text from PDF →

A scan can hold anything from a lease to a medical form. Before you upload one anywhere, look at the PDF jobs that need no upload.

Frequently asked questions

Why can't I select the text in my PDF?

Because the pages are images. A scanner or a phone camera produces a picture of the document, and the file contains no characters for a reader to select. OCR is the process that recognizes those pixels and turns them back into characters. Before reaching for it, check that the PDF doesn't already have a text layer with the text extraction tool.

Is there a free OCR that doesn't upload my document to a server?

Yes. Apple's Live Text works on iPhone and iPad, and Apple says it recognizes text with on-device intelligence. Tesseract is an open-source engine that runs on your own machine from the command line. Google Drive is free too, but the file is uploaded to Google to be converted.

How accurate is OCR?

It depends mostly on the image, and no single figure fits every document. Tesseract's documentation recommends images of at least 300 DPI and warns that a badly skewed page or dark scanner borders reduce recognition quality. Always check the resulting text before relying on it.

Does OCR work on documents in Spanish or other languages?

Yes. Tesseract publishes trained data for Spanish and for more than a hundred languages, and you need to tell it the document's language when you run it. For Live Text, Apple documents that language and region availability varies, so confirm yours is on the list.

Does Docuboxer have OCR?

Not yet. The text extraction tool only reads PDFs that already contain text, and when it finds pages that are images it lists them instead of returning an empty result. There is no OCR in the suite for now.

What if the scanned PDF has a lot of pages?

If you only need the text of a few, split them out first with the split PDF tool so there is less to process. If your OCR app works with images, export the pages with PDF to JPG and feed them in one by one.

Related tools

Sources