PDF to Text
Read the text out of a PDF, then copy it or save it as a .txt file. Works for PDFs that have a text layer. Nothing is uploaded.
https://flxcode.com/pdf-to-text/
or drop a PDF here
Up to 200 MB together. Password-protected PDFs can't be opened.
No text was found in this PDF. It is probably a scan, which is a picture of text. Reading a picture needs OCR: try Image to Text on pictures of the pages (PDF to JPG makes them).
Your files never leave this device. There is no upload, no account and no watermark. How we count
Problem or idea? Email us
How to use it
- Choose a PDF. Leave the pages box blank for all pages, or type some, like 2-4.
- Press Extract text. The words appear in the box below.
- Press Copy text, or Download .txt. If the box says no text was found, the PDF is a scan and needs OCR.
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. Pieces on the same line stay together.
| 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, markers off | Invoice 4821 ⏎ Total 99.50 USD ⏎ ⏎ ⏎ ⏎ Thank you |
| Same three pages, "Page N" 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 is splitting on spaces: the first page above has 5 words. A PDF where every page comes back empty is a scan, and the page says so.
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. This page does the same test for every page you pick.
| PDF made by | Text layer | This page gives |
|---|---|---|
| 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 was run through OCR before | Yes (hidden) | The OCR text, with its mistakes |
Numbers this uses
- Only the text layer is read. Nothing is guessed from the picture of a page, so there are no recognition mistakes, and also no text from a scan.
- A new line starts at the end of a line as pdf.js reports it, or when the baseline moves by more than half the height of the text.
- Page markers (optional): a line like "--- Page 3 ---" before each page, with the real page number.
- Limit: 200 MB for the PDF. Output name: pdf-text.txt, UTF-8. Your file name is never used.
What happens to your file
pdf.js (Mozilla, Apache-2.0) reads the PDF in a worker in this tab and returns the text of each page. The text is put in the box on this page. It is not stored and not sent anywhere. The PDF may make it fetch a fixed font or decoder file from this site; that request does not contain your file or its name.
If the file holds something private, such as a contract or a medical letter, this is the point of doing it here. There is no server step for the file or the text.
Counts of events such as "merge" or "download" are kept without cookies, and never a file name, size or page count (details). The PDF code is pdf-lib (MIT licence) and pdf.js (Apache-2.0 licence): open source used on this site.
Scanned PDFs need OCR
- A scan is a picture of a page. It has no words in it, so this tool returns nothing for it, and says so.
- To read a scan, make images of the pages with PDF to JPG, then run each image through Image to Text, which does OCR in your browser.
- Tables come out as lines of cells in reading order. Columns that sit side by side in a layout can be interleaved. Check the result before you rely on it.
FAQ
How do I copy text from a PDF?
Choose the file and press Extract text. The words appear in a box. Press Copy text. You can also type page numbers first to get only some pages.
Why does it say no text was found?
The PDF is probably a scan: a picture of each page with no words in it. A PDF reader can't select text in it either. Use OCR: PDF to JPG, then Image to Text.
Can I convert a scanned PDF to text here?
Not directly. This page reads the text layer only. For a scan, make images of the pages with PDF to JPG and run them through Image to Text.
How do I save the text as a .txt file?
Press Download .txt after the text appears. The file is pdf-text.txt in UTF-8, so accents and non-Latin letters stay right.
Does it keep the layout, tables and columns?
It keeps the reading order and the lines. Tables turn into lines of cells and side-by-side columns can mix. For a clean table, copy it from the text and fix it in a spreadsheet.
Can I get only some pages?
Yes. Type them in the pages box, such as 1-3, 7. Turn on the page lines option to see which page each part of the text comes from.
Why are some letters wrong or missing?
Some PDFs map their fonts in a way that hides the real letters, often old files or ones made from a print driver. The text layer is then wrong at the source. A scan plus OCR can give a better result.
Is my PDF uploaded?
No. The page reads the file with your browser and builds the result in this tab. There is no server step. To check it, open the page, wait a second, choose a file, then switch to airplane mode and run the job. It still works. The one exception is the pdf.js reader on pages with previews, images or text: for a PDF with unusual fonts or image types it may load a fixed font or decoder file from this site first. That request does not contain your file or its name.
More from FLXCode
PDF to JPGNew
Turn PDF pages into JPG images at 72, 150 or 300 dpi. Runs in your browser, nothing is uploaded.
Extract Pages from PDFNew
Keep pages like 2-4, 9 as one new PDF, in the order you type. Runs in your browser, nothing is uploaded.
Split PDFNew
Split a PDF by page ranges, every N pages or one file per page. Runs in your browser, nothing is uploaded.
Text to SpeechNew
Read any text aloud with your browser's voices. Pick a voice, set speed and pitch. Text stays on your device.