How to extract text from a PDF and save it as TXT
Upload the PDF to PDF to text, pick a mode and download a UTF-8 TXT. Run scans through OCR PDF first: recognized pages reach the TXT in either mode, but on them Layout works just like Plain.
PDF to text takes the text layer out of a PDF and saves it as a UTF-8 TXT file. That file is easy to search, quote, import into another program or process with a script. Images, fonts, colors and table cells do not carry over: you get characters, line breaks and a few service lines that mark the pages.
PDF to text has no built-in text recognition. If your pages are scans or photos, you need a separate OCR step first, and only then the extraction. Below are the steps, the difference between the two modes, and what the finished file looks like.
Check whether the PDF contains text
Open the PDF in any viewer and try to select one sentence. If individual words get highlighted and you can paste them into a plain text editor, the document has a text layer. If the whole page is selected at once, like a picture, you are looking at a scan.
Check several pages, not only the first one. A single file often mixes pages saved from Word with scanned attachments that carry signatures and stamps. The reasons text refuses to be selected are covered in Why you cannot select or copy text in a PDF.
A file that needs a password to open will be rejected with a message saying so. Remove the password first, as described in How to Remove a PDF Password.
Step-by-step extraction
1. Open PDF to text and drag the file into the upload area or choose it from your device. One run processes one PDF. 2. In the "Parameters" block, set "Text extraction mode" to "Plain" (the default) or "Layout". 3. Decide whether you need the "Insert page breaks" checkbox. It is on by default. 4. You can leave "Output file name" empty; a name is assigned automatically. 5. Click "Process file", wait until it finishes and download the TXT. 6. Open the result in an editor that understands UTF-8, and read any warnings shown next to the result.
Which mode to choose: Plain or Layout
"Plain" returns the text in the order it is stored inside the file, without alignment spaces. For letters, contracts and articles exported from a word processor, that order usually matches the reading order. "Layout" reproduces the position on the page: it inserts spaces and blank lines so that words land roughly where they sit on the sheet.
A price list shows the difference well. Say the PDF has a table where one row holds the item code AB-120, the product "Cable" and the price 250. In Layout mode the table row stays a row: code, name and price end up side by side, separated by spaces. In Plain mode the same fragment may come out column by column — first all the codes, then all the names, then all the prices — if that is how the table is stored in the file. The link between a product and its price is then lost.
Two-column text behaves the other way round. Layout places the columns next to each other, so every line of the TXT contains a line from the left column and, after a run of spaces, a line from the right one. That is awkward to read straight through. Plain more often gives you the whole left column first and then the right one. If in doubt, process the file twice and compare both results on the same page.
Scans after OCR: what each mode gives you
OCR PDF keeps the page image as it is and adds an invisible layer with the recognized text. Plain mode reads that whole layer, while Layout sees only part of it or none at all. So in Layout mode the tool checks every page: if Layout finds less than 80% of the letters and digits that Plain finds, the page is taken from Plain mode. Choosing Layout therefore no longer leaves recognized pages empty or triggers the warning that the PDF has no text layer.
The trade-off: on recognized pages Layout gives the same result as Plain, with no columns side by side and no alignment spaces. The decision is made page by page, so in a mixed file the pages with native text keep the Layout arrangement. For scans, recognize the file in OCR PDF, download the PDF with its text layer and upload it to PDF to text; the mode can stay on "Plain". Choosing the recognition language and checking OCR quality are covered in How to recognize text in a scanned PDF using OCR.
What ends up in the TXT file
Each page starts with a label line: `--- Page 1 ---`, `--- Page 2 ---` and so on. The labels are written in the interface language of the site you ran the job from. If a page has no text, the label is followed by `(empty page)`. That line helps you find scanned sheets in a mixed document: the empty-result warning appears only when no page at all contains text.
The "Insert page breaks" checkbox adds a page-break character before the label of every following page (form feed, code 0x0C, usually written as `\f` in code). Editors display it differently: as blank space, a small box, or the symbol FF or ^L. Printers and some programs treat it as an instruction to start a new sheet.
Turning the checkbox off removes only that character. The page labels stay either way, which is useful: they tell you which page a quotation came from.
How to clean out the service lines
If the labels get in the way, remove them with a regular-expression find and replace. In editors such as VS Code, Notepad++ or Sublime Text, the pattern `^--- Page \d+ ---$` with an empty replacement does the job. Search for the page-break character as `\f` or `\x0C`. In scripts it is convenient to split the text into pages on `\f`: with page breaks enabled, each chunk starts with its own page label.
After the text of each page the tool adds one blank line, which you can also remove. Running headers, page numbers printed in the document and repeated table headings are left alone: they are part of the text layer. Delete them only after making sure they really are repetition and not information you need.
Common problems and how to spot them
- The TXT is empty and there is a text-layer warning. The file is a scan. Run it through OCR PDF and upload the recognized file to PDF to text.
- After OCR, Layout did not put the columns side by side. That is expected: recognized pages come out as in Plain mode. Layout keeps columns only on pages with native text.
- Prices got separated from products. The table is stored column by column. If the PDF has native text rather than an OCR layer, try Layout mode, and if you need real cells, read How to Extract Tables From PDF to Excel.
- Odd symbols instead of letters. The PDF embeds a font without a proper character map: the letters look right on screen, but the text layer holds different codes. Check whether the same passage copies correctly from a viewer; if it is garbage there too, the problem is in the file itself.
- After OCR, O and 0 or l and 1 get mixed up. Recognition mistakes go into the TXT unchanged. Check item codes, amounts and dates by hand.
- Accented or non-Latin letters turned into gibberish. An older program opened the UTF-8 file with a different encoding. Open it again and choose UTF-8 explicitly, for example through a text import dialog.
Check the result before you use it
Read the beginning, the middle and the last page of the TXT and compare them with the PDF. Look separately at footnotes, tables and columns, where line order breaks most often. For quotations, compare every excerpt with its source page; the label tells you its number. Keep the PDF next to the TXT: if the mode turns out to be a poor fit, you can extract the text again in the other mode.
Why is my TXT file empty?
It means no page contains any text: the pages are images without a text layer, and the file has to be recognized in OCR PDF first. The mode has nothing to do with it: the recognized layer reaches the TXT in both Plain and Layout. If a file that has already been through OCR comes out empty, check the OCR result — most likely recognition found no text on those pages.
When should I choose Layout and when Plain?
Plain gives continuous text in the order it is stored in the file and suits articles, letters and PDFs after OCR. Layout keeps positions with spaces: table rows stay rows, but two text columns end up side by side. It keeps that arrangement only for a PDF's native text: pages after OCR come out as in Plain mode.
Does turning off "Insert page breaks" remove the page labels?
No. Only the page-break character (\f) between pages disappears; lines such as "--- Page 2 ---" stay in the TXT.
Can PDF to text read scanned pages on its own?
No, this tool has no built-in OCR. Process the scan in OCR PDF, download the result and then upload that file to PDF to text. Either mode works, but recognized pages come out as in Plain mode in both cases.
What encoding is the TXT saved in?
UTF-8. Modern editors open it correctly. If an older program shows strange symbols instead of accented or non-Latin letters, open the file again and choose UTF-8 explicitly.