Skip to main content

How to Extract Text from a PDF (and When You Need OCR)

Can't copy text from a PDF? Learn the 10-second test for scanned files, how to extract text for free in your browser, and when you need OCR instead, with a worked example.

u
useToolify Team
··schedule 7 min read ·visibility 24 views
How to Extract Text from a PDF (and When You Need OCR)
In this article expand_more

You need three paragraphs from a 30-page PDF for an assignment, or a clause from a rental agreement to paste into an email. You press Ctrl+C, paste, and get either jumbled text or nothing at all. The fix depends on one question that most people never ask: does your PDF actually contain text, or is it just a picture of text?

Text PDF or scanned PDF? How to tell

A PDF made from Word, Google Docs, a bank's website or most government portals usually has a text layer. The letters are stored as real characters, so a program can read them directly. Getting them out is quick and exact.

A PDF made by scanning paper, or by turning phone photos into a PDF, is different. Each page is an image. To a computer it's just coloured pixels, so software has to work out which letters the shapes are. That process is called OCR (optical character recognition), and it is always a best guess.

Some files are a mix, such as typed pages followed by a scanned signature page.

Here's the 10-second test. Open the PDF in any viewer and try one of these:

  • Select a sentence. If you can highlight individual words, there's a text layer. If you can only draw a box over the page, or nothing highlights, it's probably an image.
  • Search for a word you can see. Press Ctrl+F (Cmd+F on a Mac) and type a word from the page. No match usually means no text layer.
  • Run it through a text extractor. If the result is empty or says no text was found for a page, that page is scanned.

The third option is best for long files, because it reports page by page.

How to extract text from a normal PDF

If your PDF has a text layer, use Extract Text from PDF. It reads the existing text in your browser, with no guessing involved.

  1. Open the tool and drop your file on the box that says "Drop your PDF here, or click to browse".
  2. Wait for the "Extracting text from PDF" message to finish.
  3. Look at the summary bar. It shows the number of pages, words and characters found.
  4. Scroll through the cards labelled Page 1, Page 2 and so on. Each one shows its own word count and has a Copy button.
  5. Use Copy All to grab everything, or Download .txt to save a text file named after your PDF.
  6. Click New File when you want to start over.

Two limits are worth knowing before you start. First, the output is plain text joined with spaces, so line breaks, bullet points and table layouts inside a page get flattened. Expect to re-add paragraph breaks yourself. Second, a password-protected PDF won't open. If you know the password, remove it first with Unlock PDF. That tool needs the correct password; it doesn't crack or bypass one. Unlike the extractor, it processes the file on a server (the page says it's deleted after the request), so think about that before using it on sensitive documents.

When you need OCR, and how to run it

If the extractor shows "No readable text found" for some or all pages, switch to PDF OCR. It renders each page as an image and reads the letters, all inside your browser. The OCR engine and language data are downloaded the first time you use it, so you need an internet connection for that first run.

  1. Drop your file on the box that says "Drop a scanned PDF, or click to choose". It handles up to 15 pages per run.
  2. Pick the right Document language. The list includes English and Hindi along with ten other languages. This matters more than people expect.
  3. Set Render quality. The default is 2x. Move it up to 3x or 4x for small print or faint scans. It's slower but usually more accurate.
  4. Click Extract text. You'll see the engine load and then progress page by page. Use Stop if you picked the wrong settings.
  5. Check the confidence badge on each page. Green means 80% or higher. Amber means you should read that page against the original.
  6. Use Copy all or Download .txt. The text file marks each page with a line like "--- Page 3 ---".

One language per scan is the rule here. If your page mixes English and Hindi, run it once in each language and take the better result for each section.

Worked example: a 42-page scanned file

Say you've scanned a 42-page set of class notes and want the text. The OCR tool reads only the first 15 pages of any file, so you need to break it up first.

Open Split PDF, choose the Every N Pages tab and enter 15 in Pages per Part. You'll get three files:

  • Part 1: pages 1 to 15
  • Part 2: pages 16 to 30
  • Part 3: pages 31 to 42 (the last part holds the 12 leftover pages)

Run each part through OCR with the same language and render quality, then paste the three text files together in order.

Now check accuracy. Pick three passages of about 40 words each from different pages, which gives you 120 words, and compare them with the scan. Suppose you find 6 wrong words. That's 6 out of 120, or 5%. If the whole document is around 2,400 words, you should expect roughly 120 words that need fixing. It's only a rough estimate, but it tells you if a skim is enough or if every line needs proofreading.

A 5% error rate is a strong hint that the scan itself is the problem. Rescanning is often faster than correcting 120 words by hand.

Tips for better OCR results

  • Scan at 300 DPI if you can. The documentation for Tesseract, a widely used open-source OCR engine, says it works best on images of at least 300 DPI. Most scanner apps let you set this.
  • Keep pages straight. Tilted text breaks line detection. If you're using a phone, hold it flat above the page rather than at an angle.
  • Use even light. Shadows and glare on glossy paper cause plenty of errors.
  • Don't expect handwriting to work. This kind of OCR is built for printed text.
  • Know the limit of render quality. A higher setting helps with small print, but it can't add detail the original scan never captured.

Mistakes to avoid

  • Running OCR on a PDF that already has text. You'll swap exact text for guessed text and gain nothing. Always try the extractor first.
  • Trusting numbers without checking. OCR commonly mixes up 0 and O, 1 and l, 5 and S. In marks, amounts, dates or account details, one wrong digit can matter a lot, so compare every number with the original.
  • Expecting tables to survive. Both tools give plain text. Multi-column pages can also come out in the wrong order, so rebuild tables by hand.
  • Copying someone else's work. Extracting text makes quoting easier, not citing optional. If the text goes into an assignment, credit the source.

If you need page images rather than text, for example to attach one page to a form, our guide on converting PDF to JPG and back covers that. For splitting and combining files more generally, see merging, splitting and compressing PDFs.

Frequently Asked Questions

Why does copying text from my PDF give me nothing?

The PDF is most likely a scan, so each page is an image with no text layer. Run it through PDF OCR first.

Is OCR text 100% accurate?

No. Even a clean scan can have a few errors. Always check names, numbers and dates against the original before you use the text anywhere important.

Can I extract Hindi text from a PDF?

If the PDF stores real Hindi text, the extractor can usually pull it out, though complex scripts sometimes come out with spacing or ordering problems. For scanned Hindi pages, choose Hindi in the OCR tool's Document language list.

Will the formatting of my PDF be kept?

No. Both tools produce plain text. Headings, bullets and tables are flattened, so plan to reformat after pasting.

Is my file uploaded when I extract text?

Extract Text from PDF and PDF OCR both process your file in the browser rather than uploading it. Unlock PDF is the exception: it sends the file to the server for processing and says the file is deleted afterwards.

Share:

Try the tools mentioned in this article

Free, browser-based, no account needed.

Get new tool tutorials in your inbox

No spam — just new posts, occasionally.

Comments (0)

No comments yet — be the first to share your thoughts.