PDF to Text Converter
Operator: Abdulla Al Fahad. How tools are built and checked
Selecting text in a PDF viewer and pasting it elsewhere gives you line breaks in the middle of sentences, column text read across the page and page headers mixed into paragraphs. The PDF to Text Converter reads the text layer of the PDF in your browser and rebuilds it as plain text, either as paragraphs with the wrapped lines joined back together or as one output line per line on the page, with optional markers between pages.
The two layouts serve different jobs. Paragraphs is for prose you want to quote, search or feed to an indexer or a language model: wrapped lines are joined and paragraphs are separated by a blank line. Lines is for invoices, statements, forms and tables, where the position of each value on the page carries meaning and joining lines would scramble it. Both can carry ----- Page N ----- markers, which make it easy to cite a page or split the text file later.
Key features
- Paragraphs layout joins wrapped lines back into paragraphs; Lines layout keeps one output line per PDF line.
- Optional ----- Page N ----- markers between pages in either layout.
- Copy button, UTF-8 .txt download (no byte-order mark) and an Edit in Word editor hand-off for formatting the text.
- Switching layout or markers reuses the text already read, so the preview updates without reading the PDF again.
- Detects password-protected and scanned PDFs and explains what to do.
How the text is extracted
The text layer is read with the same engine as the PDF to Word converter on this site, which groups positioned fragments into lines and lines into paragraphs; that page describes the grouping rules in detail. One rule matters more for plain text than for Word: a space is inserted between two fragments on a line only when the gap between them is wider than about 15% of the font size, which is how word spacing lost in the PDF is recovered without inventing spaces inside words.
In the Paragraphs layout, each paragraph is written on one line and paragraphs are separated by a blank line; headings are not marked in any way, since plain text has no headings, so a title simply becomes a short paragraph. In the Lines layout every PDF line becomes one line of text in page order, and nothing is joined. The Insert a marker line between pages option adds ----- Page 3 ----- style lines before each page in either layout.
The output is UTF-8 without a byte-order mark. Hyphenation at line ends is not undone, form fields, annotations and comments are not part of the page text and so do not appear, and a PDF whose fonts lack a Unicode mapping produces unreadable characters that no converter can repair. Password-protected files and scans without a text layer stop with a message.
How it works
The PDF is opened with pdf.js in a web worker. For each page the text content is read as positioned fragments with font names and sizes. Fragments are merged into lines by baseline, lines are joined into paragraphs by spacing and size changes, and both the paragraph blocks and the raw lines are kept in memory.
The text exporter then writes either the paragraphs, one per line with blank lines between them, or the raw lines separated by newlines, inserting page markers when requested. Because both representations are kept, changing the layout only reruns the exporter.
Common use cases
- A researcher extracts the text of a journal article to search it and quote from it.
- A developer feeds the text of PDF documentation into a search index or a language model.
- An accounts team pulls line items out of a supplier's PDF invoice with the Lines layout to paste into a system.
- A paralegal compares two versions of a contract by converting both to text and running a diff.
- A student saves the text of a reading pack that was exported from a word processor, rather than scanned, for a screen reader or note-taking app.
How to use this tool
- Drop a PDF on the upload area. The text appears in the preview straight away.
- Choose Paragraphs for prose or Lines for invoices and tables, and tick the page marker option if you will cite or split by page.
- Read the first page of the preview for joined words, hyphenation and repeated headers.
- Copy the text or download the .txt file, or open it in the Word editor to format it.
Example
PDF page lines (as positioned on the page)
Quarterly summary (y=700, 16pt)
Revenue grew in the second (y=670, 11pt)
quarter, driven by new sign-ups. (y=656, 11pt)
The team hired six engineers. (y=620, 11pt)Text output: Paragraphs layout (left) and Lines layout (right)
Quarterly summary
Revenue grew in the second quarter, driven by new sign-ups.
The team hired six engineers.
-------------------------------------------
Quarterly summary
Revenue grew in the second
quarter, driven by new sign-ups.
The team hired six engineers.Tips for best results
- Use Paragraphs for articles, reports and letters, and Lines for invoices, statements, tables and anything laid out in columns of values.
- Turn on page markers when you need to cite page numbers or split the text by page afterwards; a script can split on the marker lines.
- If words run together in the Paragraphs preview, the PDF has unusual spacing; the Lines layout often reads better in that case.
- If the preview is gibberish, the PDF's fonts have no Unicode mapping. Run the file through an OCR tool and convert the OCR output instead.
- For headings and formatting rather than plain text, use PDF to Word, which detects headings from font sizes.
Edge cases to watch
Hyphenation at line ends is kept as written. A word split as docu- and ment stays split in the Paragraphs layout, with a space after the hyphen.
Text columns, repeated page headers and scanned pages behave exactly as they do in PDF to Word: columns are read across, headers appear as lines, and scans produce no text. The page markers make repeated headers easy to find and delete.
Some PDFs encode text with fonts that lack a Unicode map, which produces random-looking characters. That is a property of the file, not of the converter.
Right-to-left scripts and mathematical notation often come out in a different order from how they appear on the page.
Form field values are not included, because they live in the form layer rather than the page text. Print the filled form to a new PDF first to flatten them.
Frequently asked questions
What is the difference between the two layouts?
Paragraphs joins the wrapped lines of each paragraph into one block and separates paragraphs with a blank line. Lines keeps every line as it appears on the page, which is better for invoices, tables and forms.
The conversion stopped and said no selectable text was found. Why?
The PDF is a scan: pictures of pages with no text layer underneath. An OCR tool has to add the text layer first; the OCR result then converts normally.
Can I get headings and formatting instead of plain text?
Use the PDF to Word converter, which detects headings from font sizes and produces a .docx. This tool deliberately produces plain text only.