Skip to main content
PDFOctober 8, 20263 min read

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.

#pdf to text#extract text from pdf#copy text pdf#pdf to txt#free
How to Extract Text from a PDF (Copy Without Broken Lines)

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.

PDF to Text

Get the plain text out of your PDFs, page by page.

Try it for free
  1. Drop your PDF onto the page.
  2. Choose the pages: all of them, the first one only, or a range.
  3. Copy the text to the clipboard or download it as a .txt file.

Text PDF or Scanned PDF?

Everything depends on how the PDF was created:

Type of PDFHow to recognize itTool
Text PDF (exported from Word, a website, software)You can select a word in the viewerPDF to Text: instant, exact
Scanned PDF (photocopy, scanner, phone photo)Selection draws a rectangle over an imageConvert the pages to images, then use OCR
MixedSome pages selectable, others notBoth, 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

Ready to compress your PDFs ?

Free, fast, and no sign-up required.

Try it now

Related articles