PDF text extractor
Pull the text out of a PDF page by page on your device, with page markers, a count for each page and a plain warning when a page is a scan with no text to extract.
A clear answer. Here’s how.
Reads the text of a PDF page by page with PDF.js (Mozilla’s PDF reader, which this site bundles and runs on your device). A PDF stores text as positioned pieces, in the order its content stream draws them, not as lines and paragraphs, so this tool rebuilds lines from PDF.js’s text items: a line ends after an item PDF.js flags with hasEOL, or when the baseline moves by more than the text height, and a space is added between two pieces on one line where the gap is wider than a fifth of the text height. “Keep the PDF’s line breaks” gives one line per line on the page. “Join lines into paragraphs” starts a new paragraph where the gap to the previous line is more than one and a third times the page’s usual line spacing (the smaller quarter of the gaps, capped at one and a half times the text height), where the text size changes by more than 15%, or where reading jumps back up the page (a new column); inside a paragraph lines are joined with a space, except that a line ending in a hyphen after a letter is joined without one and keeps its hyphen, so hyphenation is not repaired. Rows of a list or table that are spaced like lines of text can be joined into one paragraph, so use “Keep the PDF’s line breaks” when the layout matters. “One piece of text per line” lists PDF.js’s items as they come. Text order follows the file’s content stream. Columns, tables, headers, footers, footnotes and page numbers are not detected or repaired, and a table comes out cell by cell in whatever order the file drew it. PDF.js normalises ligatures such as fi to fi, but fonts that map letters to private codes or give no Unicode map produce odd characters or the replacement character, and the page says how many it found. Right-to-left text is whatever PDF.js returns and is not repaired: in a test PDF printed by Chrome, Hebrew came out in reading order, but Arabic came out as separate letters in presentation forms and in screen order, which reads backwards, and a Japanese character came out as a look-alike code point from the Kangxi radicals block. Characters are counted as Unicode code points, spaces included and line breaks not; words are runs of non-space characters, so Chinese and Japanese text, which has no spaces, gives few words. A scanned PDF is a picture of each page: it has no text layer, nothing can be extracted from it, and this tool does not do OCR (turning a picture of text into text), because OCR needs WebAssembly, which this site’s security policy does not allow. A page with no text layer is reported as such, and one that also holds a picture as probably a scan; pictures are looked for on at most the first 30 pages that have little text. Limits: 30 MB, 500 pages, no password-protected files, about ten million characters of text, and 90 seconds of reading, after which the tool stops and says where. It never changes the PDF.