FastBankConvertFastBankConvert home

PDF to TXT: Plain Text With or Without Layout

By FastBankConvertPublished June 10, 2025Updated June 10, 2025

To convert a PDF to TXT, run the file through a text extractor and choose one of two outputs. Layout mode pads lines with spaces so columns stay lined up, which suits tables and statements. Reading order drops the columns and lets sentences flow, which suits letters and reports. Scanned pages need OCR first, because they hold no text.

Layout mode or reading order in a PDF to TXT file?

Pick layout mode when the PDF holds a table, and reading order when it holds prose. Layout mode keeps each printed line as one text line and fills the gaps with spaces. Reading order joins words into paragraphs and ignores where they sat on the page, so a table becomes a stream of loose values.

The open-source pdftotext tool shows the choice plainly. Its pdftotext manual page describes a -layout option that keeps the original physical layout "as best as possible", and says the default undoes columns and hyphenation and writes text in reading order. Other extractors offer the same two outputs, often under different names, so look for a "keep layout" or "preserve formatting" switch.

The same lines, two ways

Here are three example transaction lines from a made-up statement page, extracted both ways.

Layout mode:

03/02   COFFEE CART #12             4.75        1,204.25
03/03   PAYROLL DEPOSIT                     1,850.00   3,054.25
03/05   CITY WATER BILL            61.40        2,992.85

Reading order:

03/02
COFFEE CART #12
4.75
1,204.25
03/03
PAYROLL DEPOSIT
1,850.00
3,054.25

The layout version keeps the debit and credit in different columns, so you can still tell money out from money in by position. The reading-order version is easier to search for a payee name, yet it has already lost which number was a withdrawal. Neither is wrong. They answer different needs.

Page breaks and running headers in a TXT file from a PDF

A text extractor marks the end of each PDF page, and it copies whatever the page repeats at the top and bottom. Expect a page separator between pages and the same header lines, such as the bank name and page number, printed again on every page of the text file.

pdftotext puts a form feed character between pages unless you pass -nopgbrk, according to the same manual page. A form feed is an invisible control character. Most editors show it as a small symbol or as nothing at all, and a script can split the file on it to get one chunk per page.

Running headers are the larger nuisance. A ten-page statement gives you ten copies of the account summary line and ten "Page 3 of 10" lines in the middle of the transactions. Search for the repeated text and delete it before you do anything else with the file. If you need the lines in a spreadsheet afterwards, junk lines removed now are junk rows you will not have to filter later.

What does a PDF to TXT conversion lose?

A TXT file keeps characters and line breaks and nothing else. Fonts, bold, colours, ruled lines, images, links and form fields all disappear. Cell boundaries vanish too, so a table survives only as spacing, and a description that wrapped onto two printed lines becomes two separate text lines.

Some losses matter more than they look:

  • Scanned pages. A scan is a picture. The extractor finds no text and writes a blank page unless you run OCR first.
  • Negative signs in colour. If a statement shows debits only in red, the TXT file shows them as plain numbers with no sign.
  • Mangled fonts. The pdftotext manual warns that some PDFs use font encodings so damaged that text comes out as nonsense, with OCR as the only way round it.
  • Character encoding. Accented payee names need UTF-8, which is pdftotext's default output encoding. Open the file as UTF-8 or the accents turn into junk.

Checking a PDF to TXT result against the original page

Check the text against the PDF before you trust it. Compare the first and last lines of each page, count the lines of one table, and search for two or three values you can see on the page. If any of those fail, the extractor misread the layout and the rest needs a closer look.

A quick routine for a statement-sized file:

  1. Open the PDF and the TXT side by side.
  2. Pick one page and confirm its first and last transaction lines both appear in the text.
  3. Count the transactions on that page in both versions.
  4. Search the TXT for the closing balance shown on the PDF.
  5. Look for lines where two columns ran into each other with no space between them.

Step five catches the most common layout-mode fault. When two columns sit close on the page, the extractor can drop the gap, and "4.75" followed by a balance of "1,204.25" becomes one long string.

PDF tables that should not end up as a TXT file

A text file is the wrong target when you plan to add, sort or filter the numbers. Every column you need has to be cut out of padded lines again later. Send the table to a format that stores cells instead, and keep TXT for searching, quoting and archiving the words.

Better targets by job:

For bank statements, FastBankConvert is built to put each transaction in its own row and return Excel, CSV or JSON, which would skip the padded-text stage entirely. It is not open yet, and the get started page is where to ask for a note when trial conversions begin.

All posts in CSV, JSON and text output