How to Extract Text from a PDF (Copy Without Broken Lines)
Copying text from a PDF often gives broken lines, missing spaces or nothing at all. Here's why, and how to extract clean text from any PDF — including scanned ones.
Why Is Copying Text from a PDF So Painful?
You select a paragraph in a PDF, paste it into Word or an email… and get a mess: a line break every few words, hyphens in the middle of words, columns mixed together, sometimes strange characters.
The reason: a PDF doesn't store "paragraphs". It stores pieces of text placed at precise coordinates on the page — a line here, a word there. The notion of paragraph only exists visually. When you copy, the viewer has to guess the reading order, and it often gets it wrong.
Extract the Text of a Whole PDF
The PDF to Text tool reads the text layer of the document with PDF.js and rebuilds the lines and paragraphs from the position of each piece of text. Everything happens in your browser: the PDF is never uploaded.
- Drop your PDF onto the page.
- Choose the pages: all of them, the first one only, or a range.
- Copy the text to the clipboard or download it as a
.txtfile.
Text PDF or Scanned PDF?
Everything depends on how the PDF was created:
| Type of PDF | How to recognize it | Tool |
|---|---|---|
| Text PDF (exported from Word, a website, software) | You can select a word in the viewer | PDF to Text: instant, exact |
| Scanned PDF (photocopy, scanner, phone photo) | Selection draws a rectangle over an image | Convert the pages to images, then use OCR |
| Mixed | Some pages selectable, others not | Both, page by page |
Extraction returns nothing?
If the result is empty, the PDF almost certainly contains only images. Export the pages with PDF to Image at 3x scale in PNG, then run them through the OCR tool: you'll get the text back.
What Can Go Wrong (and How to Fix It)
- Multi-column layouts (newspapers, scientific papers): the text may come out column by column or line by line across columns. Re-read and reorganize if needed.
- Hyphenated words at line ends: use the find and replace tool to rejoin them.
- Unwanted line breaks: the same tool, in regex mode, can merge lines into paragraphs.
- Headers and page numbers repeated on every page: filter them out with the text filter or a search-and-replace.
- Strange characters: some PDFs use fonts without a proper character map; the text then can't be extracted correctly — OCR is the fallback.
Use Cases
- Quote a report or a study without retyping it.
- Translate a document: extract the text, then paste it into your translator.
- Analyze contracts: search for a clause, compare two versions with the text comparison tool.
- Feed data to a spreadsheet: extract an invoice or a statement, then clean it up.
- Accessibility: get a plain text version for a screen reader or a large-font display.
Protected PDFs
Some PDFs forbid copying via their security settings. An encrypted PDF that requires a password to open can't be read without that password. If you're the owner of the document, remove the protection with the software that created it.
Conclusion
To get clean text out of a PDF, don't copy and paste from the viewer: extract the text layer with a dedicated tool, which rebuilds the lines and paragraphs. If the PDF is a scan, go through images and OCR. In both cases, your document stays on your computer.
Share this article
Related articles
How to Extract Text from an Image (Free OCR in Your Browser)
Copy the text from a screenshot, a photo of a document or a scanned page: how OCR works, how to get accurate results, and how to do it for free without uploading your image.
How to Edit a PDF Online for Free: Text, Signature, Annotations
Change a line of text, add a signature, highlight a passage or number pages: how to edit a PDF in your browser without Acrobat, and without uploading the document.
How to Convert a PDF to JPG (or PNG) in High Quality
Turn PDF pages into images to post them on social media, insert them in a presentation or send them by message. JPG, PNG or WebP, which resolution, and how to keep text sharp.