PDFMove
Extracting Text From PDF to TXT: A Step-by-Step Practical Guide
How-To

Extracting Text From PDF to TXT: A Step-by-Step Practical Guide

6 min read

You have a PDF and you need the text inside it as plain text — maybe you're going to upload it to a plagiarism checker, paste it into an email, or process it with a simple Python script. Since the PDF format was designed to preserve visual layout, extracting text from it isn't always as simple as it looks. In this guide, we walk through converting PDF to TXT step by step, and cover the typical mistakes that mess up the result and how to avoid them.

Why doesn't extracting text from a PDF always come out "clean"?

A PDF doesn't work with paragraph and line logic the way a word processor file does. It records exactly where each character should be drawn on the page. So when converting a PDF to plain text, the tool is essentially reading the positions of the characters on the page and trying to arrange them into a sensible reading order. Most of the time this works fine, but when multi-column pages, tables, or scanned (image-based) documents are involved, the output can look different than you'd expect. The steps below help you minimize these discrepancies.

Step by Step: Converting PDF to TXT

1. Prepare your file

Knowing what type of PDF you're working with beforehand makes things easier:

  • Text-based PDF: A file produced with "save as PDF" from a program like Word or Google Docs. These files already have a text layer, so extraction is fast and accurate.
  • Scanned/image PDF: A file created from a scanner or a photo, which is essentially a picture of the page. Even though there appears to be text, there's no selectable text layer underneath.

Open your file and try selecting a word with your mouse. If you can select it, there's a text layer; if you can't, you have an image-based PDF, and a plain conversion will give you an empty or meaningless output.

2. Open the tool and upload your file

When you open the PDF to TXT tool, you can drag and drop your file or select it from your device. Once the file is uploaded, the tool starts scanning the text layer page by page to extract the content.

3. Specify the page range (if needed)

If you have a 200-page report but you're only interested in the section between pages 12-18, specifying that page range instead of converting the whole file both speeds up the process and keeps the resulting file from being unnecessarily long.

4. Start the conversion

Once the process starts, the tool reads the character positions in the PDF's internal structure and turns them into lines and paragraphs. For small documents this takes a few seconds; for files with many pages or lots of images, it may take a bit longer.

5. Download and review the output

Once the process finishes, you get a .txt file. Before pasting it elsewhere, we recommend giving it a quick look — especially checking whether the line order matches what you expected in documents with tables or multi-column pages.

6. Clean up if needed

You may see page numbers, repeated header/footer text, or odd spacing at line breaks in the resulting text. These come from the PDF's original design, not from a tool error. You can quickly clean up these repeated elements in your text editor with "find and replace."

Practical Tips

  • Be patient with large files. Technical documents with hundreds of pages, or PDFs with heavy graphics, need more processing time than a short text file.
  • Check the encoding. Special characters can sometimes look garbled in older PDFs that use different font encodings. Opening the output in a text editor that supports UTF-8 (such as VS Code or Notepad++, instead of Notepad) usually fixes this.
  • Watch out for multi-column pages. In a newspaper-style, two-column PDF, text extraction tools can sometimes read the columns line by line instead of left to right. If you're working with a document like this, always review the output.
  • Don't expect tables to stay as tables. When a table is dumped into plain text, it turns into lines separated by spaces or tab characters between cells; the row-column structure isn't automatically preserved. If you need to work with tabular data, you may need to manually edit the source.
  • Keep the original file. The TXT output is convenient for editing or analysis, but it loses visual formatting (bold text, images, page layout). Always keep a copy of the original PDF.

Common Mistakes and Pitfalls

"No text came out, the file is empty." Your PDF is most likely a scanned image with no selectable text layer. In this case, you need to run optical character recognition (OCR) first; a plain text extraction tool can't extract a layer that doesn't exist.

"The words came out stuck together." Some PDF generation tools leave the spacing between words as visual whitespace rather than encoding it as an actual space character. This shows up especially in files made with old or custom fonts. In such cases you may need to fix the output manually.

"The line order is jumbled, the sentences don't make sense." This generally happens with multi-column layouts or pages with sidebars/footnotes. It doesn't mean the tool misread the page — the PDF's internal structure itself may define a confusing reading order.

"Special characters turned into question marks or boxes." This usually happens because your text editor opened the file with the wrong encoding. Try reopening the file with UTF-8 encoding.

"I couldn't upload the file." For encrypted PDFs or ones with editing restrictions, you may need to remove the restriction first. Corrupted or incomplete PDF files can also throw an error on upload.

When Should You Use TXT, and When Something Else?

If your goal is just to read the text, search it, or feed it as raw text to an AI tool, TXT is ideal — it's small, opens fast, and works flawlessly on every platform. But if you need to preserve formatting (headings, bold text, table structure), you should consider converting to an editable document format instead of TXT; in that case, TXT only gives you the raw content, not the visual structure.

Conclusion

Extracting plain text from a PDF is often a simple process that takes just a few clicks, but knowing the type of file you have (text-based or scanned) ahead of time and reviewing the output makes it easier to get the best result. By following the steps above, you'll save time and end up working with a clean, usable text file.

Frequently Asked Questions

The special characters in my extracted PDF text look garbled — what should I do?

This is usually related to the encoding setting of the text editor the file is opened in. Try reopening the TXT file in an editor that supports UTF-8 (such as VS Code or Notepad++). If the problem persists, the PDF itself may be using an old font encoding, in which case some special characters may need to be corrected manually.

Can I convert a scanned (photo-like) PDF to TXT?

Plain text extraction reads the existing text layer inside the PDF. Since scanned documents don't have such a layer, a direct extraction returns an empty or meaningless result. For these kinds of files, you first need to apply optical character recognition (OCR), and then extract the resulting text as TXT.

Can I convert only certain pages of a multi-page PDF into text?

Yes. By specifying a page range before conversion, you can extract only the section you need. This both shortens the processing time and prevents unnecessary content from piling up in the resulting file.

Try this out right away with PDF → TXT.

Try PDF → TXT