📃 PDF to Text

Pull the real text out of a PDF with paragraphs rebuilt from the document’s own line spacing. Tells you when a PDF is a scan instead of returning nothing.

Free No Signup Required Browser-Based
📃

Choose a PDF, or drop it here

Read in this tab. The document is never uploaded.

What PDF to Text Does

There are two completely different ways to get text out of a PDF, and which one applies to your file decides whether the answer is exact or approximate. A born-digital PDF — anything produced by a word processor, a report generator or a browser’s print-to-PDF — already contains its text as character codes with coordinates. Reading it back is lossless and instant. A scan contains no characters at all, only pictures of them, and the only way in is optical recognition, which guesses.

This tool does the first. That matters because a number of converters route every PDF through OCR regardless, which throws away a perfect answer and hands back an approximate one complete with recognition errors. And when there is genuinely no text layer, this says so plainly and points at the OCR tool, rather than returning an empty box and letting you conclude it is broken.

The work that is actually involved is reconstruction. pdf.js hands back positioned fragments, not lines and not paragraphs — a single visual line often arrives as several separate items, and nothing in the file marks where a line ends or a paragraph begins. Joining them naively gives either one enormous run-on or a hard break after every fragment, which is why so much extracted text arrives mangled.

So fragments are grouped into visual lines by their baseline coordinate, with a tolerance because superscripts and font changes shift the baseline within a line. Then the gaps between consecutive baselines are compared against the median gap for that page — a gap noticeably larger than the document’s own normal leading is a paragraph break. Using the median means the rule adapts to each document instead of assuming a point size.

How to Use PDF to Text

  1. Add a PDF, or drop it onto the box
  2. Choose the pages, as ranges such as "1-3, 7, 10-"
  3. Pick reflow for prose, or keep line breaks where the breaks matter
  4. Extract, then copy the text or save it as a .txt file

Formula Used by PDF to Text

Deciding where a paragraph ends

newParagraph ⟺ gap(line k−1, line k) > 1.6 × median(all gaps on the page)

gap
the vertical distance between two consecutive line baselines, in points
median
the middle gap on that page — the document’s own normal line spacing
1.6
the multiplier separating ordinary leading from deliberate paragraph spacing

Worked example

A page set with 12 pt lines and 8 pt of extra space between paragraphs.

  1. Most consecutive baselines are 12 pt apart, so the median gap is 12
  2. The threshold is 12 × 1.6 = 19.2 pt
  3. Lines within a paragraph are 12 pt apart — below the threshold, so they join
  4. A paragraph boundary is 12 + 8 = 20 pt — above it, so a break is inserted

Result: Paragraphs come back as paragraphs. A fixed threshold in points would fail on any document not set at that exact size.

Extraction or recognition — which does your PDF need?

Your PDFHas a text layer?Use
Made by Word, Google Docs, LaTeX, print-to-PDFYesThis tool — exact, no errors
Scanned on a flatbed or photographedNoThe image-to-text reader
Scanned then run through OCR software alreadyYes, a recognised oneThis tool, but the text carries the original OCR’s errors
A mix of bothPartlyThis tool; the pages reporting almost no text are the scanned ones

Which line setting to use

SettingOutputBest for
Reflow paragraphsLines joined; breaks only at real paragraph boundariesProse you are pasting into a document or an editor
Keep line breaksOne output line per visual linePoetry, code, addresses, lists — anywhere breaks carry meaning
Raw fragmentsUnjoined pieces as storedDiagnosing a document that extracts strangely

How to Read Your Result

No text at all means a scan, not a failure

A PDF with no text layer has nothing to extract. That is a fact about the file rather than a problem with the extraction, and the useful response is recognition rather than a different extractor. The tool names the situation instead of leaving you to guess.

Some pages empty means a mixed document

A report with scanned appendices, or a contract with a photographed signature page, produces exactly this. The count of near-empty pages is shown so you can tell which parts need OCR rather than assuming the whole file failed.

Columns interleave, and that is the format

A PDF stores glyphs at coordinates. It does not record that two blocks of text are parallel columns rather than one continuous flow — your eye infers that. Reading order is therefore top to bottom across the full page width, which interleaves a two-column layout.

Limitations & Accuracy Notes

  • Layout is not preserved: columns interleave, tables lose their structure, and headers and footers appear inline.
  • Text inside images is invisible to this method — that is what OCR is for.
  • Scanned PDFs return nothing, by design. The tool says so and points at the right alternative.
  • A PDF using a non-standard encoding without a proper character map can return the wrong characters — rare, and a property of the file rather than the reader.
  • Ligatures may come through as single characters (fi rather than fi) depending on how the document was produced.
  • Encrypted documents are refused rather than partially read.

Frequently Asked Questions

Is this OCR?
No, and that is the point. A born-digital PDF already contains its text as character codes with positions on the page — reading it back is exact and instant, with no recognition errors at all. OCR is the fallback for documents that have no text layer, and it guesses. Tools that route every PDF through OCR are discarding a perfect answer and returning an approximate one.
I got nothing back. Is it broken?
Almost certainly not — your PDF is a scan. The pages are pictures of text and the file contains no characters to extract, so there is nothing for this operation to find. The tool says so explicitly rather than handing you an empty box, and points you at the image-to-text reader, which recognises characters from pixels.
What is the difference between the three line settings?
"Reflow paragraphs" joins lines back together and starts a new paragraph only where the spacing says one begins — best for prose you are pasting elsewhere. "Keep line breaks" gives one output line per visual line, which is what you want for poetry, code, addresses or anything where the breaks carry meaning. "Raw fragments" shows the pieces exactly as the PDF stores them, which is mostly useful for working out why an odd document is behaving strangely.
How does it know where a paragraph ends?
By measuring. pdf.js returns positioned fragments with no line or paragraph markers, so the fragments are grouped into visual lines by their baseline, and the gaps between consecutive baselines are compared against the median gap for that page. A gap noticeably larger than the document’s own normal line spacing is a paragraph break. Using the median means it adapts to each document rather than assuming a font size.
Why are my columns and tables jumbled?
Because a PDF has no idea it contains a table. It stores glyphs at coordinates; the structure you see is something your eye reconstructs. Text is read top to bottom and left to right within each line, so a two-column layout interleaves. That is a property of the format, not a shortcoming of the extractor.
Is my document uploaded?
No. pdf.js reads it in your browser and this site is a static export with no backend. Nothing is transmitted.

References & Further Reading

By OnlineToolHubs Team • September 2026