Read a PDF's text in the order a person reads it
Initializing in your browser…
Read text off a picture with Tesseract, after preparation that measures the type and enlarges it: 8px text went from a 53 percent character error rate to 8. Every word carries a confidence and a box drawn on the picture.
Pull out a PDF's pictures as the files it holds
Split a PDF by page, by batch, or by range
You need to quote from a two column paper, and pasting it from the viewer comes out interleaved.
Input
paper.pdf · find columns on
Output
Read as two columns, split at 232 to 320 points: the left column entire, then the right
The columns are found from the glyph runs BEFORE the lines are built, which is the only point at which the gutter still exists: two columns emitted a line at a time share their baselines, so grouping into lines first merges them. A page written bottom to top also comes out top to bottom, because the order is taken from the baselines rather than from the file. The page says how it read each page and where the gutter is, and column detection can be turned off when the guess is wrong.
Pull the text out of a PDF in the order a person reads it, not the order the file happens to store it in. Columns are found before the lines are built, so a two column page comes out one column at a time rather than interleaved, and a page whose content was written out of order still comes out in order. The tool says how it read each page and where the columns it found are, and you can turn column detection off when the guess is wrong. Search the result, read it page by page, and export it as plain text, Markdown, JSON or CSV. Everything happens in your browser and nothing is uploaded.
Get a paragraph out of a PDF whose viewer blocks copy and paste, with the columns in the right order.
Export as JSON or CSV to get the text into a script, a spreadsheet or a search index, with the page each line came from.
Find out whether a document has a text layer at all before trying to search it, and which of its pages are scans.
Two column papers are exactly the case a stream-order extractor scrambles, and exactly the case column detection is for.
Read as two columns, split at 232 to 320 points: the left column comes out entire and then the right, which is what poppler does with the same file and what a person does with the paper.
A page whose lines were written bottom to top comes out top to bottom, because the order is taken from the baselines rather than from the file.
Every page reports as empty and the tool says so in words, rather than showing an empty box and leaving you to guess whether it failed.
A PDF content stream carries no notion of a line, a paragraph or a column. It carries positioned glyph runs, and the order they were written in is whatever the program that produced the file happened to do. So the reading order is a property of the GEOMETRY and never of the stream, and an extractor that follows the stream is right only by luck.
That is measurable, and it was measured. On a fixture whose stream order was chosen to disagree with its reading order, the previous version of this tool produced a page written bottom to top BACKWARDS, and joined the two columns of a two column page into single lines reading "L01 left column line 01 R01 right column line 01". The words were all there: on eight pages of ordinary body text it produced every one of the 248 lines poppler finds. Only the order was wrong, which is the failure mode nobody notices until they paste the result somewhere.
So the tool does three things in order, and says which it did.
First it finds the COLUMNS, working on the glyph runs and not on the lines. That ordering is the whole of it: two columns emitted a line at a time share their baselines, so grouping into lines first merges them and the gutter between them is gone before anything looks for it. A gutter here is an x interval that no run occupies, at least a quarter inch wide, with real text on both sides occupying the same vertical band. That last condition is what stops a heading at the top left and a page number at the bottom right from looking like a layout.
Then it groups each column's runs into LINES by their baseline, with the tolerance taken from the type's own size rather than a constant. A fixed five points is half a line at six point type and a fifth of a line at twenty four, so one number both joins lines that should be separate and splits lines that should not be.
Then it orders the columns left to right and the lines within each top to bottom, joining runs on a line with a space where the gap is wider than a space in the type that drew them.
Every one of those decisions is reported. The page says how it read the page you are looking at and where the gutter it found is, and column detection can be turned off when the guess is wrong for your document.
The document is read ONCE. The previous version called two separate extractors that each parsed and walked the whole file, which on an eight page document was 489 milliseconds where one pass is about 100. A page range reads only the pages named, which is real work saved rather than pages rendered and then discarded.
And the search box is a search box. It looks for the characters you type, so an open bracket finds an open bracket; a regular expression is available behind its own switch, and a pattern that does not compile is reported rather than raised. The previous version built a regular expression from the raw input inside an effect with no guard, so typing a single "(" threw and took the page down.
Because the reading order was taken from the order the file stored the words in. A layout engine that fills two columns a line at a time writes left line one, right line one, left line two, and an extractor following that produces exactly what you saw. This tool finds the columns from the geometry first.
Turn Find columns off and extract again. The page-by-page view tells you how each page was read and where the gutter it found is, so you can see what it decided before you change anything.
Probably not: the page most likely has no text layer, which is what a scan is. A scanned page is a picture of words, and there is nothing to extract from it. The tool names those pages and says that optical character recognition is what they need.
Not unless you turn on the regex switch. By default it looks for the characters you type, so searching for "(" finds an open bracket. With the switch on, a pattern that does not compile is reported on the page rather than raised.
It keeps the line and paragraph structure and the reading order. Bold, italic, type sizes, tables and images are not part of plain text and are not carried over.
No. The PDF is read in your browser and never leaves it.
PDF parsing and editing happen in your browser. Documents, and everything inside them, are never uploaded or stored remotely.