Blog

How to Extract Text From a PDF: Digital, Scanned, Highlights

Updated · 14 min read

How to Extract Text From a PDF: Digital, Scanned, Highlights

Listen to this post

0:000:00

Share this post

Contents

The fastest way to extract text from a PDF depends on one thing: whether the file has a text layer. If you can click and drag to select words, you can copy them directly or export the whole file to plain text. If you can't, the page is a picture of text, and you need OCR (optical character recognition) to turn it into characters first. After that, the real work starts: getting the highlights, notes and quotes out in a form you can use.

This guide covers both cases, the problems that trip people up (garbled characters, lost highlights, scrambled columns), and what to do with the text once you have it.

TL;DR

  • Try selecting a sentence first. If it highlights, the PDF has a text layer and you can copy or export it with no OCR.
  • If you can't select anything, the file is a scanned image. Run OCR, and scan at a high resolution if you control the scanner.
  • Highlights are stored separately from the text. Extract them before anyone flattens the file, or they are gone as data.
  • Expect OCR errors. Check names, numbers and quotes against the page before you cite anything.
  • Extracted text is only useful if you can find it again. Keep each quote attached to its page and your own note.

Table of Contents

Step one: find out what kind of PDF you have

A PDF is a container. Some PDFs hold real text, with fonts and character codes. Others hold only a photo of each page. They look the same on screen, which is why people are often surprised when copying fails.

The test takes ten seconds. Open the file, pick the text-select tool and try to highlight a sentence. If you can't highlight characters, the file has no embedded text layer and needs OCR before it becomes searchable or selectable. Press Ctrl+F (Cmd+F on a Mac) and search for a word you can see on the page. No hits means no text layer.

Three situations come up again and again:

What you see What it means What to do
Text selects cleanly, search works Digital PDF with a text layer Copy, or export to text or Word
Nothing selects, search finds nothing Scanned image PDF Run OCR
Text selects but pastes as nonsense Broken font encoding, or a poorly OCR'd scan Re-run OCR on the pages, or extract from the image

The third case is common with older academic scans. Someone ran OCR years ago, the text layer is there, and it is wrong. Treat it like a scan.

Extracting text from a digital PDF

Copy and paste, done properly

For a paragraph or two, copying is fine. Select, copy, paste into a plain-text field first to strip odd formatting, then move it to your document. Problems you will meet:

  • Hard line breaks at the end of every printed line. Find and replace line breaks with spaces, then restore paragraph breaks by hand.
  • Hyphenation. A word split across lines arrives as "compre- hension". Search for a hyphen followed by a space and fix it.
  • Columns. Two-column journal layouts sometimes paste in reading order and sometimes jump across the gutter. If the order is wrong, select one column at a time.
  • Ligatures and symbols. "fi" and "fl" may become odd characters, and math or Greek letters often turn into boxes.

Export the whole file

When you need the full document, export instead of copying. Most PDF readers and word processors can save a PDF as plain text or as a Word file. Experts who handle large volumes of research suggest that converting the whole file to another format is often more efficient than copying by hand, because conversion can keep tables and layout that plain pasted text loses.

Use plain text when you want to search, run word counts or feed the content into another tool. Use Word when the tables and headings matter. Either way, skim the output against the original: footnotes, headers and page numbers usually end up in the middle of sentences.

Why you sometimes can't copy at all

If selection is blocked even though the page clearly contains text, two causes are likely. The file may be an image, which is the OCR case below. Or the publisher may have set permissions that restrict copying. If you have legitimate access to a document, such as a paper from your library, check the library's copy for a version that allows it, or ask the author. Don't try to bypass protections on material you aren't licensed to use.

Extracting text from a scanned PDF with OCR

OCR looks at the pixels, identifies characters and adds them back as an invisible layer under the original image. Free tools do this online, and Adobe's OCR page describes the same process: drop in the file, pick the document language, run recognition and download a searchable PDF. Most word processors, phone scanning apps and desktop PDF editors now include an OCR option as well.

A workflow that works for most scans:

  1. Set the language. OCR guesses badly when it thinks a Spanish document is English.
  2. Run OCR on the whole file, not page by page, so the output stays one searchable document.
  3. Test the result. Search for three distinctive words you can see on different pages.
  4. Spot-check the hard parts: numbers, proper names, footnotes, tables.
  5. Save the OCR'd copy as a new file and keep the original scan.

Get better input, get better text

OCR accuracy depends heavily on the image. Guidance from Adobe suggests scanning at 400 to 600 dpi, and warns that poor lighting, skewed pages and low resolution produce wrong output that needs cleanup or a rescan. If you photograph pages with a phone, shoot straight on, in even light, with the page flat. Shadows from a curved book spine cause more errors than almost anything else.

Scan conditions that affect OCR accuracy

Expect mistakes

No OCR is perfect. The Library of Congress's digital scholarship guide notes that errors creep in from faded type, ink blots and poor print quality, such as reading "rn" as "m", and that institutions often use people to clean up results. For you, that translates into a habit: never paste an OCR'd quote into a paper, brief or report without comparing it with the page image. Dates, dollar figures, and names are where a single wrong character does the most damage.

Extracting highlights and annotations

People who search for how to extract highlights from a PDF usually have a file they marked up over weeks and want the marked passages in one list. This is harder than copying text, for a structural reason.

A highlight isn't part of the text. It is a separate annotation object, essentially a set of rectangles placed over the page. A tool has to map those coordinates back to the underlying text to recover the quoted words. When it doesn't, you get an export containing page numbers and your comments, but not the highlighted sentences. That is the usual reason an "export comments" file looks empty.

Three practical rules follow:

  • Check the export before you trust it. Open the result and confirm it contains the actual passages, not only page numbers.
  • Don't flatten first. Flattening bakes annotations into the page as pixels. Once that happens, the separate annotation data that extraction tools rely on is gone, so export your notes and highlights before flattening, printing to PDF or "saving as image".
  • Scanned PDFs have no real highlights to read. If you marked up a scan, the marks may be drawn on the image. You will need OCR plus a manual pass, or a tool that lets you re-select the passages.

If you want to mark up PDFs in a way that stays useful, our guides on highlighting PDFs in Chrome, Edge and Firefox, annotating PDFs on iPad and a PDF highlighting strategy that turns highlights into flashcards cover the habits that make later extraction painless.

Citations, references and images

Three related jobs are worth separating, because each needs a different approach.

Citations in your own notes. When you copy a quote, copy its page number with it. Reconstructing where a sentence came from a month later is slow and error-prone.

The reference list of a paper. Pulling the bibliography out of a PDF is a parsing task: split entries, identify authors and titles, and verify them against a database. We walk through it in extracting references from PDFs in four steps with API validation.

Figures and charts. Text extraction ignores images. If you need a figure at full quality, see how to extract images from PDFs. The same limit applies to AI chat tools. In OpenAI's help documentation, standard text-based file retrieval uses only the text layer, and images are discarded in text-only extraction, with visual retrieval reserved for ChatGPT Enterprise. So "can ChatGPT extract text from a PDF?" is yes for digital files, but charts and diagrams may not come through on standard plans.

Which method fits which job

Your goal Best approach Watch out for
One quote from a digital PDF Select and copy Line breaks, hyphens
Whole digital PDF as text Export to text or Word Headers, footnotes mid-sentence
Scanned book chapter OCR, then proofread Misread characters, columns
Your highlights and comments Export annotations before flattening Empty exports with page numbers only
Many papers for a project Batch convert, then organize Losing the source link to each quote
Tables and layout Convert to Word or Excel Merged cells, split rows

Perspective: extraction is the easy half

We build Omphalis for people who save more than they read: students with a folder of forty papers, professionals with a backlog of industry reports. What we see is that getting text out of a PDF is rarely the real bottleneck. The bottleneck is what happens after. A folder of extracted .txt files has the words but none of the context: you lose the page, the surrounding argument and your own reaction to the passage.

Perspective: extraction is the easy half — overview diagram

That is why we think extraction should keep the source in view. A quote pasted into a document is a claim without a witness. A quote that stays attached to its original passage, next to your note about why it matters, can be checked, challenged and reused. It is also why we are cautious about tools that boil a document down to a fast summary. A summary can feel like understanding while hiding the exact sentence you needed. We would rather help you read the difficult passage, ask a question and get an answer that points back to the source.

So our advice is simple. Extract what you need, but keep the original within reach, and keep your notes tied to the passages they came from. You can read more about this thinking in the case for comprehension.

— Omphalis Team

From extracted text to something you can use

Once you have the words, a few habits keep them useful:

  • Name files consistently. Author, year and a short title beat "scan_0042.pdf".
  • Keep the OCR'd copy and the original. If a quote looks suspicious later, you can check the image.
  • Store each quote with its page number and a one-line note on why you saved it.
  • Group by question, not by file. Notes organized around what you are trying to answer are easier to reuse than notes organized by where they came from. Our guide to organizing academic papers into an auditable workflow shows one way.
  • Export when you need to share. If you are sending annotated material to a classmate or colleague, see how to export notes to PDF without losing multipage attachments.

If reading on a screen is the problem, you can also turn a PDF into audio and keep your notes while you do it: listening to PDFs with notes, not just speed summaries.

Where Omphalis fits

Omphalis is a reading environment for the things you save: articles, papers, podcasts and videos. You can import PDFs, EPUBs and Word documents, read a cleaned and structured version, get inline explanations of hard passages, attach notes to the original text, ask questions with citations from the source, and export your notebooks. The free plan lets you start without a card. Paid plans include features such as deep reading, PDF extraction, advanced listening and import and export.

Current plans, as listed on our pricing page:

Plan Monthly Yearly
Free No published price No published price
Pro 9 USD per month 90 USD per year
Premium 19 USD per month 190 USD per year
Scholar 39 USD per month 390 USD per year

Unit packs are also available, from 10 USD one-off. If you mostly want to capture web pages as you browse, there is also a browser extension for Chrome and Firefox. To see how your files are handled, read about security, encryption and your data. You can start from the Omphalis home page.

FAQ

Why can't I copy text from a PDF?

Usually the PDF is a scanned image with no text layer, so there are no characters to select. Run OCR to create one. Less often, the document has permission settings that restrict copying, in which case you should look for a version you are allowed to copy from.

What is the difference between text extraction and OCR?

Text extraction reads the text layer already stored in a digital PDF, so it is quick and faithful to the original. OCR is for pages that are only pictures: it recognizes shapes as characters and can make mistakes, so its output needs proofreading.

Can ChatGPT extract text from a PDF?

Yes, for files with a text layer. According to OpenAI's help documentation, standard plans read the text and drop images, while Enterprise adds visual retrieval for diagrams and charts. For a scanned PDF, run OCR first and check the result.

Why did my exported highlights come out empty?

Highlights are annotation objects stored apart from the text. If the exporter can't map them to the underlying text, you get page numbers and comments without the quoted passages. A flattened file has no annotation data left to export at all, so always export before flattening.

How accurate is OCR on old scans?

It varies with print quality and scan resolution. Faded type, ink blots and skewed pages cause misreads, and the Library of Congress notes that cleanup by people is common. Scanning at 400 to 600 dpi helps, and you should verify any quote, number or name before citing it.

Sources