Skip to content

PDF to text

Extract the plain text from a PDF, with optional OCR.

Updated

Add your files

PDF

How to extract PDF text

  1. 1

    Add one or more PDFs. Each one becomes its own .txt file.

  2. 2

    Leave Source on Detect automatically so that only pages without a text layer are read by OCR, or choose Text layer only or Force OCR. Pick the OCR language for pages that need it, and keep Mark page breaks on to label each page.

  3. 3

    Press Extract PDF text and download the text files. The result says whether the text came from the text layer or from OCR.

  • Use Word to text when the document is a Word .docx rather than a PDF; it can also give you HTML or Markdown.
  • Use PDF to Word when you want an editable document with headings, paragraphs and lists rather than plain lines of text.
  • Use Compare PDFs when you have two versions of a PDF and only want to know which lines of text changed.

Text layer or OCR

A PDF made from a word processor carries a text layer, and the tool reads it directly: every line on a page is taken in the order pdf.js finds it, upright text first, top to bottom and left to right, with the spaces that PDF files often leave out put back wherever the gap between two runs of text is wide enough. Under Detect automatically, a page with fewer than 25 characters of text counts as scanned: it is drawn at 200 dpi and read by the Tesseract OCR engine in your browser with the language you chose. Force OCR treats every page that way, which helps when a text layer exists but copies out as gibberish, and Text layer only never runs OCR.

What the text file looks like

With Mark page breaks on, each page begins with a line reading "--- Page 3 ---" and pages are separated by a blank line; switched off, the pages simply follow one another. Lines are kept as lines, so a paragraph that wraps in the PDF arrives as several lines, and text set in columns is read across the page rather than down each column. Nothing else is added: no headings, no formatting, no pictures. The file is UTF-8 plain text named after the PDF.

Scans and empty results

When OCR was used, the result lists the method as OCR; unlike OCR PDF, this tool shows no confidence figure, so proofread names and numbers. A file from which no text at all could be read is reported with the suggestion to re-run with Force OCR. In a run over several files, the Method line says OCR as soon as any page of any file was read that way.

Questions about PDF to text

Why is the text in the wrong order?

Lines are read top to bottom across the full width of the page, so two columns are interleaved line by line, and a table comes out row by row with its cells run together. For tables, PDF to Excel reads the columns from their positions instead.

Can I get the text of a password-protected PDF?

Yes, if you know the password: you are asked for it, and the PDF is read in your browser.

Which languages can the OCR read?

English, Spanish, French, German, Portuguese, Italian, Dutch, Hindi, Arabic, Russian, Japanese and simplified Chinese, one language per run. The model for that language is downloaded the first time it is used; the PDF itself is read in your browser.

Advertisement