PDF to text
Read the text out of a PDF, then copy it or save it as .txt.
https://flxcode.com/pdf/pdf-to-text/
Add the PDF to read
PDF, JPG, PNG, HEIC, WebP · or
Your files never leave this device. There is no upload, no account and no watermark. How we count What this tool keeps and sends.
Problem or idea? Email us
To extract text from PDF pages, pick the pages and press Convert to text. You can copy text from PDF pages with one button or download a .txt file. This works on files with a text layer. A scan has none, and the editor offers OCR first.
How to use it
- Add the PDF. Select the pages, or none for all.
- Open Convert and press Text.
- Press Extract text. The words appear in a box. Turn on page lines to see which page each part came from.
- Press Copy text, or Download .txt. If the box says no text was found, press Recognize text first.
Worked example: from pieces to lines
pdf.js hands back the text of a page in small pieces with their position. A new line starts where a piece ends its line, or where the baseline drops by more than half a line height.
| What the PDF holds | Result |
|---|---|
| "Invoice 4821" (end of line), then "Total", " " and "99.50 USD" at the same height | Invoice 4821 ⏎ Total 99.50 USD |
| Three pages, the middle one has no text, page lines off | Invoice 4821 ⏎ Total 99.50 USD ⏎ ⏎ ⏎ ⏎ Thank you |
| Same three pages, page lines on | --- Page 1 --- ⏎ Invoice 4821 ⏎ Total 99.50 USD ⏎ ⏎ --- Page 2 --- ⏎ ⏎ ⏎ --- Page 3 --- ⏎ Thank you |
| Empty pages in that file | 1 of 3 |
Counting words means splitting on spaces: the first page above has 5 words. A PDF where every page comes back empty is a scan.
Worked example: text PDF or scan?
The quickest test is to open the PDF in a reader and try to select a word with the mouse. The editor runs the same test on every page.
| PDF made by | Text layer | You get |
|---|---|---|
| Word, Google Docs, a web page printed to PDF | Yes | The text, in reading order for simple layouts |
| A bank or invoice system export | Yes | The text, tables come out as lines of cells |
| Phone scanner app, photocopier | Often none | Nothing: the pages are pictures |
| Scan that went through OCR before | Yes (hidden) | The OCR text, with its mistakes |
Limits of a text layer
Only the text layer is read. Nothing is guessed from the picture of a page, so there are no recognition mistakes, and no text from a scan.
The file is pdf-text.txt in UTF-8, so accents and non-Latin letters stay right.
Tables come out as lines of cells in reading order. Columns side by side can be interleaved, so check the result.
Some PDFs, mostly old ones or ones from a print driver, map their fonts so that the real letters are hidden. The text is wrong at the source, and OCR on the pages can give a better result.
Manual
Convert to JPG, PNG or text
- Select pages, or none for all. Press JPG, PNG or Text.
- Images: pick 72, 150 or 300 dpi. JPG also has a quality setting. PNG can have a transparent background.
- Text: Copy text or Download .txt. A scan has no text, so run Recognize text first.
- Extract images saves the pictures inside the PDF as they are, in a zip.
FAQ
Why does it say no text was found?
The PDF is probably a scan, a picture of each page with no words. A reader cannot select text in it either. Run Recognize text, then extract.
Can I turn a scanned PDF into text?
Yes, in two steps. Recognize text reads the pages in your browser, then Convert to text gives you the words.
How do I save the text as a .txt file?
Press Download .txt after the text appears. The file is pdf-text.txt.
Can I get text from only some pages?
Yes. Select the pages first, or type 1-3, 7 in the Select pages field.
Why are some letters wrong or missing?
The font mapping in the PDF hides the real letters. This happens in old files and in files from a print driver. A scan plus OCR can fix it.
Does the text leave my browser?
No. It is read in this tab and shown in the box. A font or decoder file may be fetched from this site for unusual PDFs. That request holds neither your file nor its name.
Does it keep the layout?
It keeps the reading order and line breaks, not columns or fonts. For layout, save the pages as images.
More from FLXCode
- OCR PDFRun OCR on a scanned PDF to make it searchable and selectable. Nothing is uploaded.
- PDF to PNGSave PDF pages as lossless PNG images at 72, 150 or 300 dpi. Nothing is uploaded.
- Extract pages from PDFPull chosen pages out of a PDF into a new file. Nothing is uploaded.
- Redact PDFBlack out text and areas in a PDF so they cannot be read back. Nothing is uploaded.