pythonware.com

Home / PDF tools / extract text

Reading

Extract text from a PDF

Reads the text layer and hands it back as plain text. If there is no text layer, which is the case for every scan that has not been through OCR, it will tell you that rather than returning an empty box.

Drop a file here or click to browse — a PDF with real text in it

Text

Two kinds of PDF, and only one of them has text

A PDF made by exporting from a word processor, a browser or a layout program contains the actual characters along with instructions about where to draw them. That text can be pulled straight out, which is what happens here.

A PDF made by scanning paper contains photographs of pages. There are no characters in it, only pixels arranged to look like characters. Extracting text is impossible until optical character recognition has been run over it, which is a heavy piece of software that this site does not attempt to do in a browser tab. If you land in that situation, the practical routes are your scanner's own OCR setting, a desktop PDF editor, or a document service that offers it.

About the layout

PDF stores text as positioned fragments, not as paragraphs, so reconstructing the reading order is guesswork. The join option merges fragments into flowing lines, which suits prose. The keep option preserves the line structure, which suits code, tables and addresses. Two column academic papers confound both, and usually need manual tidying afterwards.

Common questions

Why is the extracted text jumbled?

Because the original was laid out in columns or text boxes, and the fragments are stored in drawing order rather than reading order. Extracting one page at a time and tidying by hand is usually faster than fighting it.

Can I extract text from a scanned PDF?

Not without OCR. The tool checks and tells you when a document has no text layer, so you are not left wondering whether it failed.

Does it keep bold and italics?

No. Plain text has no formatting. If you need the styling, open the PDF in a word processor, which will attempt a full conversion with mixed results.

Other PDF tools