Extract Text from a Scanned Document
Need the words out of a scan or photographed page: to quote, edit or reuse them? The steps to extract clean text from an image-only PDF without retyping a
Sometimes you don't want the whole document. You just want the words. A quotation from a photocopied article. The line items off a scanned invoice. A paragraph from a report someone sent as a picture instead of a file. Retyping it by hand is slow and error-prone. Extracting the text with OCR takes seconds.
This is a different goal from making a PDF searchable. There, you keep the scan and add a hidden text layer. Here, you want the raw text pulled out so you can paste it into a doc, a spreadsheet or an email. The upside: the same recognition step gives you both.
When you want the text, not the file
Extracting text is the right move when:
- You need to quote an exact passage in an essay or report and want to avoid transcription typos.
- You're rebuilding a scanned table or list into an editable format.
- You want to feed the words into another tool: a translator, a search, a database.
- Someone sent a screenshot of text and you just need it as text.
In every case, the picture itself isn't the point. The characters inside it are.
How to extract the text
Our OCR PDF tool gives you the plain text alongside the searchable PDF, so a single run covers both needs:
- Add your scanned or photographed PDF. It's read straight off your disk, there's no upload step.
- Select the document's language so the engine loads the matching model.
- Run OCR and watch it work through the pages.
- Copy the extracted text straight from the results panel with one click, or download the searchable PDF if you want that too.
You paste the words wherever you need them. No retyping, no re-uploading, no waiting on a server.
What's happening while that progress bar moves
I built this one, and the pipeline is worth understanding because it explains most of the quirks you'll hit. Three stages, all inside your browser tab:
- Rasterise. Each page is painted to a canvas by pdf.js at twice its natural size. OCR accuracy is extremely sensitive to input resolution, which is why the default isn't 1×.
- Recognise. A tesseract.js worker reads that canvas and returns not just words but each word's bounding box: where on the page it sits.
- Rebuild. pdf-lib draws your original page image into a new PDF, then overlays every recognised word at its own coordinates using PDF text render mode 3: the mode that draws nothing at all. The words are genuinely there, selectable and searchable, and completely invisible. Your scan looks pixel-for-pixel like it always did.
That third stage is why the searchable PDF and the plain text come from a single pass: by the time we can position invisible words, we already have every word. And it's why the language model matters so much. Tesseract can only find words in a language it has loaded, and you can stack them (eng+deu) for a genuinely bilingual document.
Cleaning up what you get
OCR is accurate but not magic, expect to tidy a little, especially on tricky scans. A few quick habits:
- Read it once. Scan for obvious slip-ups: "rn" read as "m", "0" as "O", a stray line break mid-sentence.
- Fix layout, not every letter. Recognition sometimes flattens columns or tables into a single stream. Reflow the structure. The words are usually right.
- Watch punctuation. Commas, quotes and decimals are the most commonly mangled characters, double-check numbers in invoices and figures.
- Keep a copy of the original. Always verify a critical quote or total against the source scan before you rely on it.
Give the engine a fair chance
Extraction quality is set the moment you scan. To get clean text out, put clean input in:
- Higher resolution wins. Aim for 300 DPI. A crisp scan reads dramatically better than a phone snapshot taken at an angle.
- Flatten and straighten pages before OCR so lines of text run level.
- Match the language exactly, the wrong model turns readable text into nonsense.
- Stick to printed text. Handwriting, decorative fonts and faded thermal receipts are where accuracy drops.
Private by default
Because our OCR runs in your browser, extracting text never means uploading your document. That matters when the scan is a payslip, a lease or a client record: the recognition happens on your machine, and the words come out on your machine too. Nothing is stored, and nothing is sent.
There's an honest cost to that choice, and you'll feel it: a long document takes noticeably longer than it would on a server farm, because the work is being done by your laptop rather than someone else's rack. The language model downloads once on first run, too. I think that's the right trade for documents like these (a payslip that never leaves your machine can't leak from a breach that never touches it) but you should know you're paying it in seconds rather than in privacy.
Next time a scan lands in your inbox and you need the words inside it, skip the retyping entirely, a minute of OCR beats twenty minutes of transcription and the typos you'd introduce doing it. If what you actually want is the scan itself made searchable rather than the words pulled out, free OCR for PDFs explains that side. If the scan is crooked to begin with, straighten it first, level text lines measurably improve recognition.
Sources
- Tesseract.js, the OCR engine, running as a WebAssembly worker
- Tesseract OCR (Google), the upstream engine and its language models
- PDF.js (Mozilla), page rasterisation
- Optical character recognition (Wikipedia)
Written by
Chandrabhan Shekhawat
Founder of Gigai Kripa Services. Builds the 250+ privacy-first browser tools on this site and writes the guides that go with them.
Never miss a guide
New tools and how-to articles land regularly. Follow along however you like. No inbox required.
Keep reading
pdf-tools
Extract Specific Pages from a PDF
Only need a handful of pages from a long document? Learn how to hand-pick exactly the pages you want and save them as a clean new PDF. No ranges to type, no
4 mins readpdf-tools
Turn PDF Pages into Slides
Convert a PDF into image slides you can drop straight into PowerPoint, Keynote or Google Slides, with tips on aspect ratio, quality and ordering.
4 mins readpdf-tools
Are Online PDF and Image Tools Safe? How In-Browser Processing Protects Your Files
Are free online PDF and image tools safe? Learn how client-side, in-browser processing keeps files on your device, and how to spot a genuinely private tool.
7 mins read