PDF text extractor: turn choppy PDF lines into text you can reuse
Extracting text from a PDF means pulling the characters stored inside the file out as plain text you can paste into a document, an email or a translator. If you simply select and copy in a PDF viewer, every visual row ends in a line break, and running headers and page numbers land in the middle of your paragraphs. This tool reads every page, joins the rows that belong to the same paragraph, drops headers and page numbers that repeat on page after page, and gives you a clean draft. Pages that are only a picture, such as scans, can be read with OCR inside your browser.
Open the sample report and it reads a fictional four-page park survey. With the default settings the draft has 765 characters (spaces excluded) in 11 paragraphs; 8 line breaks inside paragraphs were joined and 6 lines (three headers and three page numbers) were removed. Page 4 is a scan, so it shows as a hatched bar in the page map. Click “Read 1 page with OCR” and the draft grows to 937 characters in 13 paragraphs, with 11 joined line breaks and 7 removed lines. Your file and the result are processed only in this browser.
When you need text out of a PDF
- Quoting or summarizing a report or paper: pick the pages you need and copy whole paragraphs instead of deleting line breaks one by one.
- Editing a contract, letter or form you received: paste the draft into Word or Google Docs and revise it. You can also edit right in the text box and copy from there.
- Searching a scanned document: a scan can't be selected or searched, but once OCR has read it you can search it or run it through a translator.
- Counting words or moving text to another tool: save the draft as TXT or copy it for a word counter, a spell checker or a translator.
How to use it
- Drop the PDF on the workspace or press “Choose a PDF”. If the file needs a password to open, a password box appears, and the password is used only inside this browser.
- In the page map, a bar rises for each page and shows its character count. A taller bar means more text; a hatched bar means a page with no text.
- If you only need some pages, type them in “Pages to extract”, for example 2, 4-6. Leave it empty to extract every page; pages outside the range fade out on the map.
- If some pages have no text, press “Read n pages with OCR”. You can pick 1 to 3 document languages, and the first time the engine and language data are downloaded.
- Check the draft, then use Copy all, Copy page n or Save TXT. As you scroll the draft, the original page on the right follows along, so you can compare the two side by side.
Why copied PDF text breaks into short lines, and how lines are joined
A PDF doesn't store paragraphs. It stores instructions such as “draw these characters at this position on the page”. A viewer therefore copies each visual row as its own line and can't tell you where a paragraph ends. This tool rebuilds paragraphs from the position and size of each line. A new paragraph starts when the gap between two lines is more than 1.45 times the usual line spacing on that page, when the text size changes by more than 20% (a heading above body text), or when a line starts with a list marker such as •, –, 1. or (1). Every other line is joined to the one before it by the rules below.
| Two lines in the PDF | Draft | Rule |
|---|---|---|
| Twelve observers / counted visitors at the same hours | Twelve observers counted visitors at the same hours | Latin-script lines are joined with one space |
| well- / known | well-known | A hyphen between two letters is kept and the lines are glued, because deleting it would damage a word that really has a hyphen |
| exam / ple (soft hyphen, U+00AD) | example | A soft hyphen added by a typesetting program is removed and the word is glued back |
| …on weekend afternoons. / • Survey period: September 1–14, 2026 | (new paragraph) | A line that starts with a list marker begins a new paragraph |
Mind the hyphens. A plain hyphen at the end of a line can be a real hyphen (well-known) or a break a layout program inserted inside a word (exam-ple). The PDF doesn't say which, so the tool keeps the hyphen in both cases. If a document hyphenates a lot, search the draft for hyphens and fix the few that are wrong. Ligatures such as fi and fl are expanded to the plain letters fi and fl, so words copied from a typeset paper can be searched normally.
On the original page, each extracted line gets a faint box and the lines merged into one paragraph get a bracket on the left. If you want to keep the PDF's own line breaks, press “Keep PDF lines”. That is better for poems, addresses and anything where the line itself carries meaning.
PDFs that give no text, or garbled text
When text won't copy from a PDF, it is usually one of three things. The shape of the bar in the page map tells you which.
| Symptom | Cause | Page map | What to do |
|---|---|---|---|
| No text at all | The page is a scan or a photo, so it contains only a picture and no text layer | Hatched bar | Read it with OCR |
| Boxes, � or odd symbols | The font has no character map (ToUnicode), so the shapes are drawn but the program can't know which letters they are (ISO 32000-1 9.10.2) | Outlined bar (suspected garbling) | Use “Read with OCR” or “OCR this page” |
| Refused as soon as it opens | The author turned off the “copy or extract content” permission (Table 22, bit 5) | Not shown | If you have the permissions password, make an unrestricted copy with Unlock PDF and add that copy |
A copy restriction is a condition the author set, so this tool respects it even when you open the file with its open password, and it does not work around it with OCR. A page is flagged as suspected garbling when more than 20% of its characters are replacement or private-use characters. Pages with less damage, or with letters swapped for the wrong ones, aren't caught automatically; compare the draft with the original page and press “OCR this page” if needed.
How the OCR works and how accurate it is
OCR runs on your device with Tesseract.js, the browser version of Tesseract. Each page is first drawn at the equivalent of 150 dpi and read. If the lines come out shorter than 22 pixels (small print such as footnotes), the page is drawn again at a size that makes lines about 30 pixels tall, up to the equivalent of 300 dpi, and the result with the higher confidence, weighted by character count, is kept. The Tesseract documentation recommends images of at least 300 dpi, but enlarging a scan beyond its original resolution doesn't make it sharper. On the sample report's scanned page (200 dpi), reading at the equivalent of 150, 200, 250 and 300 dpi all gave the same correct figures (61%, 38%, 24% and 17%), so on a clean scan like this one a higher setting made no difference.
- Language: choose 1 to 3 of 한국어, English, 日本語, Español and Indonesia that match the document. For an English document English alone is best; adding a language the document doesn't use can add misread letters.
- One-time download: the engine is about 4.1 MB, plus 1.2 to 3.0 MB per language (English 3.0 MB, Spanish 2.1 MB). Your browser keeps the data, so the next run starts right away.
- How OCR pages are marked: they show as dotted bars in the page map and as “[Page n · OCR]” in the draft. Their line boxes are drawn in blue so you can tell them from text that was already in the PDF.
- Getting better results: scan at 200 to 300 dpi in black and white or grayscale, with the page lying straight. Handwriting, tilted photos and busy backgrounds produce many more errors.
What counts as a repeating header or page number
With “Remove headers & page numbers” on, the tool applies the check only if at least 3 pages have 3 or more lines. It then compares the top and bottom line of every page (the top 2 and bottom 2 lines when a page has 5 or more lines). A line that appears on at least 60% of the compared pages (and at least 3 pages) is removed. Only the letters are compared, because OCR often reads a separator dot or a space slightly differently from page to page; punctuation, symbols and spacing are ignored. A line with numbers counts as the same line only when its numbers are identical on every page (“Annual Report 2024”) or when it looks like a page number, with one number going up page by page, as in “- 1 -”, “- 2 -” or “Page 1 of 10”. A subtotal at the foot of every page or a transaction line that starts with a date is therefore kept.
Removed lines are shown on the original page with red hatching. A header that changes with every chapter, or the header of a two-page document, doesn't meet the rule and stays; just delete it in the draft.
What the saved TXT file contains
Save TXT writes what you see in the text box now, including your edits, as “original-name_text.txt”. It is encoded as UTF-8 with a BOM (EF BB BF) at the start and Windows-style CRLF line endings. The BOM lets Notepad and Excel recognize UTF-8 at once, so accented letters, curly quotes and dashes don't turn into strange symbols. The text is normalized to Unicode NFC, so a letter stored as a base letter plus a combining accent becomes a single character, and ligatures such as fi become fi.
Tables, two-column papers and unusual layouts
The tool reads lines in the order the PDF stores them. A two-column paper made in Word or LaTeX normally stores the whole left column and then the right column, so it comes out in reading order. Flyers and magazines laid out in a design program store text boxes in the order they were created, so the order can get mixed up. A table comes out without cell borders: a row's text is joined by spaces or each cell lands on its own line. To move a table into a spreadsheet, extract it in “Keep PDF lines” mode and split it yourself. Japanese vertical text is read, but its line breaks are less accurate than for horizontal text.
Limits and cautions
- One PDF at a time, up to 100 MB and 500 pages. For a longer document, split it first with Split PDF.
- Only text is extracted. Bold and italics, table structure, pictures and link addresses don't make it into the draft.
- Comments, annotations and values typed into form fields are stored as separate annotations rather than page content, so they aren't extracted.
- OCR can misread characters. Always compare numbers, names and amounts with the original page. Handwriting is almost never read correctly.
- A PDF whose author blocked copying is not extracted, and a PDF whose open password you don't have can't be opened.
- Hyphens at the end of a line are kept, so a word the layout broke in two may keep its hyphen. Fix those in the text box.
As of The PDF specification, the pdf.js and Tesseract documentation and the sample measurements were checked on 2026-10-21.
Sources
- 01ISO 32000-1:2008 Document management — Portable document format (Adobe public copy)9.10 text extraction and 9.10.2 mapping character codes to Unicode (ToUnicode); Table 22 permission bits 5 (copy or extract content) and 10 (extraction for accessibility)
- 02pdf.js API — PDFPageProxygetTextContent, which returns the text items of a page with their positions. This tool reads and draws pages with pdf.js 3.11.174 (Apache-2.0 license)
- 03Tesseract documentation — Improving the quality of the outputRecommends images of at least 300 dpi; covers rescaling, borders, skew and other factors that affect OCR quality
- 04Tesseract.jsThe library that runs Tesseract OCR inside the browser. This tool uses version 7.0.0 and the kor, eng, jpn, spa and ind language data (Apache-2.0 license)
- 05Unicode Standard Annex #15 — Unicode Normalization FormsNFC normalization, which recombines letters stored as a base letter plus combining accent
Frequently asked questions
Can I extract text from a scanned PDF?
Yes. A scanned page holds only a picture and no text, so it shows as a hatched bar in the page map. Press "Read with OCR", choose the document language, and the text is read inside your browser; that page is marked "[Page n · OCR]" in the draft. OCR can misread characters, so compare numbers and names with the original page.
When I copy text from a PDF every line breaks. Can it be joined in one step?
Yes. The default "Join into paragraphs" mode rebuilds paragraphs from line spacing and text size, and joins lines of the same paragraph with a single space. A hyphen between two letters is kept, and a soft hyphen is removed. To keep the PDF's own line breaks, choose "Keep PDF lines".
Why can't I copy text from my PDF?
Usually one of three reasons. The page is a scanned picture with no text layer; the font has no character map (ToUnicode), so the shapes are there but the letters are unknown; or the author blocked copying. The first two can be read with OCR. A copy restriction can only be lifted on a copy made with the permissions password.
Can I extract text from a password-protected PDF?
If you know the open password, yes. A password box appears when you add the PDF, and the password is used only inside this browser. If the author also blocked copying, the text is not extracted even after opening, so make an unrestricted copy with Unlock PDF and add that copy.
Will the saved TXT show strange symbols in Notepad or Excel?
No. The TXT is saved as UTF-8 with a BOM at the start, so Notepad and Excel recognize the encoding at once and accented letters, curly quotes and dashes stay intact. Line breaks are saved the Windows way (CRLF).
Do tables and two-column papers come out in the right order?
Text comes out in the order the PDF stored it. A two-column paper made in Word or LaTeX usually gives the left column and then the right, but documents made in a design program can come out mixed. Tables have no cell borders, so extract them with "Keep PDF lines" and split them yourself.
Is my PDF uploaded to a server?
No. Reading the PDF, extracting the text and the OCR all happen inside your browser. The OCR engine and language data are downloaded the first time you use OCR, but the file's content and your text are never sent anywhere.
I removed repeating headers, but one is still in the text. Why?
A header is removed only when at least 3 pages have 3 or more lines and the same line appears at the top or bottom of at least 60% of those pages. Headers that change by chapter, or those in a two-page document, stay; delete them in the text box. Removed lines are hatched in red on the original page.