Guide
Extracting plain text from a PDF
By Logappradeep · ServiceNow developer
Plain text is the most portable format there is. Once the words are out of a PDF you can paste them into an email, feed them to a script, search them, translate them, count them or drop them into a spreadsheet. Copying from a PDF reader works for a paragraph, but for a whole document it is slow and often picks up odd line breaks.
How text is stored in a PDF
In a text-based PDF, each page contains instructions that place runs of characters at particular coordinates using a font. The characters are usually mapped to Unicode so they can be copied. This tool uses pdf.js to read those runs for every page, sorts them into reading order by position, inserts line breaks where the vertical position changes, and outputs the result page by page. The text appears in the browser, where you can copy all of it, copy a single page or download a .txt file.
Because extraction happens in the browser tab, the document stays on your device. That matters for statements, medical letters and contracts where you want the text but not a copy sitting on a stranger's server.
Common uses
- Pulling the body of a research paper into a note-taking app.
- Getting the transaction list out of a bank statement to clean up in a spreadsheet.
- Checking word count or searching for a phrase across a long report.
- Preparing text for translation or for a screen reader-friendly version.
Limits of text extraction
Scanned documents have no text layer; their pages are images. Extraction returns nothing for those pages, and OCR software is needed to recognize the letters. If a page comes back empty while you can clearly see words on it, that is almost always the reason.
Reading order is reconstructed from coordinates. Single-column documents come out cleanly, but multi-column layouts, sidebars and text boxes can be interleaved. Tables come out as rows of values separated by spaces, which is usually enough to paste into a spreadsheet and split by columns.
Font encoding problems occur when a PDF embeds a font without a proper Unicode mapping. The text looks fine on screen but extracts as random symbols. This is a property of the file; the same garbage appears when you copy from any reader.
Tips
Use the per-page output to grab only the section you need rather than scrolling through the whole document. If you plan to edit the text as a formatted document, PDF to Word gives you paragraphs in a DOCX file. When line breaks inside paragraphs are a nuisance, a quick find-and-replace in a text editor that joins single line breaks usually fixes it.