Make a scanned PDF searchable with local OCR
An 85,616-byte image PDF had no fonts, and pdftotext returned only a form feed. Tesseract 5.3.4 then wrote a 107,365-byte file with a GlyphLessFont text layer, and the collapsed extract matched the four drawn lines. None of the files were uploaded.
Make a scanned PDF searchable with local OCR?
An 85,616-byte image PDF had no fonts, and pdftotext returned only a form feed. Tesseract 5.3.4 then wrote a 107,365-byte file with a GlyphLessFont text layer, and the collapsed extract matched the four drawn lines. None of the files were uploaded.
Last updated
Why Ctrl+F does nothing in some PDFs
A PDF can look like a normal document while containing no usable text objects at all. Scanners often create one raster image per page. The page looks correct, but the PDF viewer has nothing textual to search.
OCR — optical character recognition — analyzes those page images and estimates the characters and words. A searchable-PDF workflow then places an invisible or visually unobtrusive text layer over the original scan so the document still looks like the source while search and copy begin to work.
Why local OCR matters
Receipts, contracts, invoices, school records, tax forms, identification documents, medical paperwork, and client drafts are exactly the files people may not want to upload to an unknown conversion site. Browser-side OCR changes the trust model: the document can be decoded, recognized, and rebuilt on the same device.
“Local” should mean more than a badge. A privacy-sensitive OCR tool should avoid sending the document bytes, page images, extracted text, or filenames to a remote processing service unless the user explicitly chooses a cloud feature.
Searchable PDF and text extraction are related but different
| Output | Best for | What changes |
|---|---|---|
| Plain text / Markdown | Notes, quotes, indexing, LLM input | You get the recognized text without preserving the original page layout. |
| Searchable PDF | Archives and documents you still want to look like the scan | The original image remains visible while a text layer enables search and selection. |
| Reconstructed editable document | Heavy editing | Layout must be recreated and will rarely match the scan perfectly. |
A good local OCR workflow
- Open the scan locally. Confirm page count, orientation, and whether some pages already contain text.
- Render only at the resolution you need. Extremely high DPI can waste memory without improving recognition.
- Run OCR page by page. Language selection matters. Mixed Japanese/English, accented European text, numbers, tables, and handwriting have different error profiles.
- Review low-confidence text. Names, totals, dates, serial numbers, and legal clauses deserve manual checking.
- Export and test. Search for a phrase, copy a paragraph, and open the result in more than one PDF viewer if the document matters.
OCR does not magically understand the document
Recognition quality depends on scan resolution, blur, skew, contrast, font, language, handwriting, page curvature, tables, and compression artifacts. A clean 300-DPI printed page is a much easier problem than a phone photo of a folded receipt.
For important records, OCR should be treated as an assistive layer, not a replacement for the image. Keep the original scan so you can verify questionable characters later.
One synthetic page, measured on 25 October 2026
The OCRmyPDF README, opened 25 October 2026, says the program adds a searchable text layer with Tesseract, can keep the scan’s resolution, and produces PDF/A by default. It does not publish a byte size, a SHA-256, or a character count for a public fixture. MakeUseOf’s 15 October 2026 note (I made years of scanned PDFs searchable) says OCRmyPDF 17.13.0 found the word “award” on a private two-page scan where Acrobat’s search found nothing, and that one other word was misread. That scan is not in this repo. This machine has no ocrmypdf command. The walkthrough below is Tesseract 5.3.4, Pillow 10.2.0, and poppler’s pdftotext 24.02.0. Installed Tesseract language packs are eng, osd, por, and spa. The fixture is English. Japanese and other languages were not run.
Pillow drew a 1700×2200 white PNG in DejaVu Sans at 54 px. The four lines are Local OCR fixture 20261025. Invoice number 18439. Room 42B. Amount due is 19.50. Pillow then saved that image as a one-page PDF. pdftotext -layout on the image PDF returned only a form feed. pdffonts printed no font rows. pdfinfo reported PDF 1.4, one page, 816×1056 pts, title scan-clean, file size 85616 bytes.
| File | Bytes | What pdftotext -layout did |
|---|---|---|
| scan-clean.png | 53059 | Source pixels. SHA-256 ee9d84e3d0ba7f1832c280b5b5e4f096fe94cc69aff671bcd7534a6e4b8ec265. |
| scan-clean.pdf | 85616 | Image only. SHA-256 7dfa22abe22111fd841ae1e63d11d174a0f08fd7401d5b6c3c14ac5f748cdbd1. Form feed, no fonts. |
| scan-clean-ocr.pdf | 107365 | Tesseract PDF. SHA-256 3fb0b95318ed1d03a43137914ee7dab7378ed8b6a8619560920c4e477671bffd. Producer Tesseract 5.3.4. Font row GlyphLessFont. |
| p2.pdf | 70692 | Same sentence, scaled to 600 px wide, Gaussian blur radius 1.8, scaled back to 1700×2200. SHA-256 14b7bea04470cc65ca209b48d5be40b6001fbea9d4299f442ebe81a1111632c8. Form feed, no fonts. PNG was 87022 bytes. |
| p2-ocr.pdf | 135395 | SHA-256 9d7d180320700882e157a46ef4c89b0f604e32e91ec76504d2a4dd55623fcfbe. Producer Tesseract 5.3.4. |
pdftoppm -png -r 150 scan-clean.pdf took 0.137 seconds and wrote a 114675-byte PNG (SHA-256 2a8ed85f195c08e17f805cbbeac2a83a32c760593279008be2383adfbd286fca). tesseract scan-clean-ppm-1.png scan-clean-ocr -l eng txt pdf took 0.255 seconds. pdftotext -layout on that OCR PDF returns the four sentences with extra spaces between some words. After collapsing whitespace, the text matches the four lines. The Levenshtein distance on that collapsed string is 0.
The blurred page used the same render path. Tesseract took 0.243 seconds. Collapsing whitespace, the extract is Local OCR fixture 20261025. invoice number 18439. Room 426 Amount due is 19.50. Distance from the source sentence is 3: the capital I, the B in 42B, and the period after 42B. The layout extract also puts Amount on its own line. A heavier pass, width 500 and blur radius 2.2, made the text file empty (distance 80, the length of the source sentence). That image PDF is 68790 bytes, SHA-256 88792fdc68cab004d36ce186a5c417385b429d377ecc2bc40005698ee6169df3. None of these files were uploaded. A clean match on this one drawn page does not predict a phone photo of a folded receipt.
Why Ctrl+F fails, and what this run changed
Ctrl+F fails when the PDF has no text objects. This image PDF had none. Search started working only after Tesseract wrote GlyphLessFont into a second file. The first file was left as it was.
Does local OCR mean the text is exact?
Not on the blurred copy. Three edits in one short sentence is enough to change a room code from 42B to 426. Check names, totals, and serial numbers against the page image.
Did this run cover a real scanner or OCRmyPDF?
No. The page image was drawn by Pillow. OCRmyPDF was not installed, so deskew, --clean, and PDF/A were not measured. The September image benchmark below is still a separate test.
Engine tests are not a scanned-PDF walkthrough
The September 2026 OCR benchmark is an image-engine test on constructed pages. It is not a scanned-PDF UI, recognition, export, reopen, or search end-to-end. Fixture OCR-DE-2026-007 matched 11 of 11 key fields, but CER is 0.3023 and WER is 0.7381, so 100% fields is not perfect full-page recognition. Cross-fixture scores do not establish that folds or skew caused the other errors.
After you export a searchable PDF, reopen the file, search for a phrase you can see on the scan, and copy a paragraph in more than one viewer if the document matters. Treat the invisible text layer as a finding aid. Protocol: evaluation methodology.
What about existing PDF metadata?
Making a PDF searchable is not the same as sanitizing the whole PDF. A document can also contain author fields, creation software, XMP metadata, attachments, form data, annotations, JavaScript, signatures, and other structures. Some of those features can be damaged or invalidated by editing.
If privacy is the goal, inspect document metadata separately. The PDF metadata viewer reads author, creator, producer, title, and dates from an unlocked file in this browser. It does not read the words on the page, and it does not unlock an encrypted PDF. If authenticity is the goal, preserve signed originals and avoid pretending an edited PDF is still cryptographically identical.
When a searchable PDF is the right output
Use it when you want the visual fidelity of a scan plus the convenience of search: old manuals, paper archives, receipts, invoices, class notes, signed forms, research material, or books you are legally allowed to digitize. If you only need to copy a few lines from a screenshot, plain image-to-text OCR is faster.
Work with PDFs locally
CreatorPrivacyKit’s document tools are designed around browser-side processing. Use the PDF Toolkit today, and local OCR workflows can plug into the same privacy-first document path.
Open Local PDF Toolkit →