Extract text
What PDF to text keeps and what it leaves out
By DeckleUpdated
PDF text extraction keeps the words, numbers and punctuation a PDF stores, plus line breaks and a marker between pages. It leaves out everything that is layout or picture: fonts, bold, columns, table grids, images, links and form fields. PDF to text gives you a UTF-8 TXT file of the selectable text on the pages you choose, in the order the PDF stores it. Knowing what does not survive tells you whether a TXT file is the right output before you start.
Pages become plain text
Selected PDF pages
Order chosen in the review
UTF-8 text
Words without page formatting
Page boundary: U+000C or a blank line
What a PDF text export keeps
| Kept in the TXT file | Notes |
|---|---|
| Words, numbers and punctuation | Exactly as the PDF's text layer stores them |
| Accented letters, symbols and other scripts | Saved as UTF-8, so é, €, ß and Cyrillic or Greek survive |
| Line breaks | A new line wherever the text moves down to a new line on the page |
| Spaces between words | Worked out from the gaps between letters, so words do not run together |
| Page boundaries | A page-break character, or a blank line, between pages |
| Your page order | All pages in order, or the order you type under Choose pages |
| Header and footer text | As ordinary lines, wherever the PDF stores them |
What it leaves out
| Not kept | What happens instead |
|---|---|
| Fonts, sizes, bold, italics, colours | Plain characters only |
| Headings as headings | They become ordinary lines |
| Columns | Text follows stored order, often column by column |
| Table borders and cell alignment | Each row becomes values separated by spaces |
| Images, charts and diagrams | Skipped; text inside an image is not read |
| Hyperlinks | The link text stays, the address does not |
| Form fields, comments and annotations | Not exported |
| Paragraph structure | Each line on the page is a line in the file |
| Text on scanned pages | Nothing, unless the page has an OCR text layer |
None of this is a fault in the export. A TXT file is a list of characters and line breaks; it has nowhere to store a font or a table border.
Example: a two-page invoice
An invoice exported with Mark where each page ended gives a file like this. The company name, address lines and invoice number come first, each on its own line. The line items come out as rows, such as Consulting, March 12 £85.00 £1,020.00, with spaces where the columns were. The logo is missing, because it is an image. The total, the bank details and the footer follow, then a page-break character and the second page's terms and conditions.
Everything you need to search or quote is there. What you could not do is paste that file into a spreadsheet and expect the columns to line up without splitting them first.
When plain text is the right output
Plain text suits jobs where the words matter and the look does not:
- Searching a long document, or many documents, for names and phrases.
- Pasting passages into an email, a note or a report you are writing.
- Counting words. See how to count the words in a PDF.
- Feeding text into a script, a translation tool or a text-analysis program.
- Keeping a lightweight copy of a document's wording alongside the PDF.
It is the wrong output when you need to edit the document as a document. Deckle has no Word conversion, so for heavy editing the best source is the original file, if you have it. How to get PDF text into Word or Google Docs shows how far pasting plain text gets you.
Reading order and characters can still go wrong
Two limits come from the PDF itself rather than from plain text.
Order. PDFs store text in drawing order. A newsletter made in design software may store a sidebar before the article it sits next to. The export keeps that order. Why extracted PDF text is in the wrong order covers the fixes.
Characters. Some fonts do not record which letter each shape stands for. The page looks correct, but the stored text is wrong. Why extracted PDF text shows garbled characters explains how to tell.
Tips
- Extract one page with a table first. It shows you how much tidying the whole file will need.
- Keep the PDF. The TXT file holds the words; the PDF remains the record of the layout.
- Use page markers if you might need to say which page a passage came from.
Frequently asked questions
Does PDF to text keep tables?
It keeps the values but not the grid. Each row becomes a line with spaces between values.
Are images or text inside images extracted?
No. Images are skipped, and words inside them are not read. That needs OCR.
Does the export keep headers and footers?
Yes, as ordinary lines. They repeat on every page, so remove them with search and replace if they get in the way.
Is a TXT file smaller than the PDF?
Usually much smaller, because it holds no fonts or images.
Related tools
- PDF to text to export the selectable text
- PDF to PNG to keep a page's look as an image
- Split PDF to keep pages as a PDF when layout matters