Turn Scanned Notes into Searchable Markdown with Offline OCR
A complete offline OCR workflow: preprocess scans, run Tesseract in the browser, proofread with DeepSeek and file the text as searchable Markdown notes.

Key Takeaways
- Tesseract compiled to WebAssembly runs inside the browser, so the scan never leaves the machine; only optional AI proofreading sends extracted text out.
- Recognition quality is decided before OCR: crop, deskew, choose grayscale plus Otsu or adaptive thresholding, and target roughly 300 DPI.
- Language packs and page segmentation modes are not cosmetic settings; they determine which characters are considered and how the layout is read.
- Use DeepSeek for punctuation and sentence repair, then verify names, numbers and dates against the scan before filing the note.
1. What happens between a photo and editable text
OCR is a pipeline, not a single button. The image is decoded, scaled, converted to grayscale, thresholded, segmented into lines and words, and then classified glyph by glyph. A language model supplies context so that an ambiguous shape becomes a plausible word. Every stage can destroy accuracy before recognition even starts.
The browser tool uses Tesseract compiled to WebAssembly and runs it in a worker thread. The engine and language pack are downloaded once and cached; after that, the page works offline. The image is drawn to a canvas, processed locally, and never uploaded. That matters for invoices, medical letters and identity documents.
Resolution is the first practical constraint. Tesseract expects text at roughly 300 DPI, which for a full page means an image about 2500 pixels wide. A phone photo often exceeds that; a screenshot of a PDF page at 96 DPI may have lowercase letters only 10 pixels tall, which is below the comfortable range for the classifier.
Grayscale and Otsu thresholding are the standard first pass. Otsu picks the threshold that maximizes the variance between foreground and background, which works well on a clean scan and poorly on a photo with a shadow across the page. Uneven lighting needs cropping, adaptive thresholding or a flat-field correction before Otsu.
Language packs change the candidate set. English, Simplified Chinese, Traditional Chinese and Japanese are different models, and a page that mixes them needs a combined selection such as English plus Simplified Chinese. Loading every pack increases memory use and can make the classifier choose the wrong script for a short line.
Page segmentation mode controls how the engine groups text. Automatic segmentation suits a normal document, a single uniform block suits a cropped article, a single line suits a caption or receipt row, and sparse text suits a screenshot with interface elements. Choosing the wrong mode is a common reason for missing columns or scrambled reading order.
Tesseract returns more than a string. It also reports bounding boxes, per-word confidence and page layout, which the interface can use to show which regions were recognized. Low-confidence words are exactly where a human should look first, so do not discard that signal when you copy the text into a note.
2. Preprocessing that measurably improves accuracy
Crop before you enhance. A photo of a page usually contains a desk, a hand or a keyboard; those pixels cost time and can confuse layout analysis. Crop to the paper edge, then rotate by the few degrees needed to make the text baseline horizontal. A one-degree skew is enough to merge two lines in a dense paragraph.
Increase contrast with restraint. A gentle curve that deepens black text and cleans the paper background helps; aggressive sharpening creates halos around every glyph and makes thin strokes look like two characters. If the scan is already high contrast, skip this step rather than risk clipping.
Choose binarization by source. Otsu is fast and reliable for flatbed scans and exported PDF pages. Phone photos with shadows or curved pages do better with an adaptive method that computes a local threshold for each neighborhood. Test both on one difficult page before running a batch.
Upscale low-resolution images before recognition. A screenshot at 96 DPI can be resampled to roughly 300 DPI with a smooth interpolator; the result is not new detail, but it gives the classifier more pixels per stroke. Downscale enormous phone photos to 300 to 400 DPI so memory stays bounded in the browser.
Preserve structure deliberately. Two-column papers should be split into two images or processed with a segmentation mode that understands columns; otherwise lines from the left and right columns interleave. Tables are worse: OCR reads cells in visual order, not logical order, so expect to rebuild the table by hand.
Keep a copy of the original and record the preprocessing steps. When a later language pack or a different threshold produces better text, you want to re-run the pipeline from the source image rather than rescan a paper document that may no longer exist. Store the source path in the note frontmatter.
Color can be filtered before grayscale. A blue highlighter or a red stamp may collapse into a dark blob when converted naively; extracting a single channel or masking saturated pixels can separate the annotation from the printed text. This is worth doing when a used textbook or a stamped invoice defeats Otsu.
---
title: "Vendor invoice 2026-11"
source: "scans/2026/11/invoice-0042.jpg"
ocr_engine: tesseract-wasm
ocr_languages: [eng]
ocr_psm: 6
ocr_dpi: 300
reviewed: false
tags: [invoice, ocr, accounts-payable]
---
# Vendor invoice 2026-11
Invoice number: INV-2026-0042
Vendor: Northwind Components
Total: 1,284.50 EUR
## OCR notes
Line breaks were normalized after recognition.
Verify the tax ID and total against the original scan before marking this note reviewed.3. Proofreading with DeepSeek without inventing facts
OCR errors are systematic. The classifier confuses rn with m, l with 1 or I, O with 0, and cl with d. It drops spaces around punctuation, splits words at line breaks, and turns a hyphenated word into two tokens. Knowing the patterns lets you fix most of the text mechanically before any model sees it.
Start with a deterministic cleanup: join words that were hyphenated across a line break, collapse repeated spaces, normalize curly quotes, and remove page headers and footers that repeat on every page. Do not guess at digits or proper nouns during this pass; mark uncertain spans instead of silently changing them.
Then use AI Studio with DeepSeek for the language-level pass. A good prompt sets boundaries: correct punctuation, sentence boundaries and obvious OCR slips; preserve names, numbers, dates and technical terms; never add facts that are not in the source; return the corrected text with uncertain passages flagged. The model is a proofreader, not a co-author.
DeepSeek is particularly useful for Chinese sentence segmentation, where OCR often removes or misplaces punctuation, and for repairing spacing in mixed Chinese and English text. It is not a source of truth for an invoice total or a contract clause. Those fields must be checked against the image by a human.
AI Studio includes 100 free daily credits, which is enough for a batch of ordinary pages; long documents and repeated retries consume more. Batch by chapter or document rather than sending a 200-page scan in one request, and keep the cleaned OCR text so a failed proofread does not force another recognition pass.
Separate local from remote processing in your head. Tesseract runs in the browser and the image never leaves the machine. AI proofreading sends the extracted text to a service. For regulated material, redact names and account numbers, use a local model, or skip the AI pass and review manually.
Ask the model for a unified diff or a list of changes, not only a rewritten paragraph. A diff makes silent edits visible and lets you reject a change that alters a date. If the interface supports it, keep the original and the corrected text side by side during review; if not, export both files and compare them before replacing anything.
4. Filing the result as Markdown notes in NexusNote
Create one note per source page, not one note per scanned document. Page-level notes make citation precise, keep individual files small, and let search return the exact page instead of a 60-page PDF. Use a consistent title such as the document name plus the page number.
Add frontmatter that survives migration: source file, page number, OCR engine, language pack, page segmentation mode, recognition date and review status. NexusNote indexes the body, and the metadata lets you find every unreviewed page or every scan that used the wrong language pack.
Keep the scan beside the note and link it with a relative path. The Markdown text is what you search and edit; the image is the evidence you check when a number looks wrong. A note without its source image is a claim without a citation.
Do not OCR a digital PDF just because it looks like a scan. Run the PDF-to-Markdown tool first; if the file contains a text layer, extraction is faster and exact. Reserve OCR for pages that are images, and mix the two approaches inside one document when only some pages were scanned.
Import the folder into NexusNote and treat it as a normal vault. The notes stay plain Markdown, the scan folder stays next to them, and full-text search covers the recognized text. You can edit a note, add links and reorganize folders without exporting anything.
Use a review queue instead of trusting the output. Tag notes as unreviewed, verify names, amounts and dates against the image, then change the status. OCR text that enters a knowledge base unchecked becomes a future citation that nobody can defend.
Name files so that a human and a sort function both understand them. A date prefix in ISO form, a short document slug and a page number keep a folder readable without opening every file. Record a hash of the source image to detect duplicate scans; the same page photographed twice is common and wastes review time.
Tools used in this workflow
Engineering Verification & Production Checklist
Before applying these steps in enterprise production workflows, ensure you verify idempotency and maintain isolated data snapshots. For bulk data operations or large file streaming, run tests within sandboxed local sessions before scaling across enterprise infrastructure to ensure complete data consistency.
Frequently Asked Questions
Does the OCR tool work without an internet connection?
Yes. The engine and language pack are cached after the first load, and recognition then runs entirely inside the browser. Optional DeepSeek proofreading needs a connection because it sends text to a model service. You can verify the local path by opening the developer tools network panel, switching to offline mode, and OCR-ing a screenshot.
Why is Chinese text sometimes recognized poorly?
The usual causes are a mismatched language pack, low resolution, vertical text, or a mixed Chinese, Japanese and English page with only one model loaded. Upscale to roughly 300 DPI, crop the margins, choose the matching pack combination, and inspect the binarized image before blaming the model.
What are the 100 free daily credits used for?
The credits belong to AI Studio and cover DeepSeek proofreading and summaries, not the OCR step itself. Local recognition is not metered. A batch of ordinary pages usually fits inside the daily allowance; long documents and repeated retries consume more. The balance resets daily, and the account page shows the current figure.
Should I run OCR on a PDF that already has a text layer?
No. Use the PDF-to-Markdown tool first; extracting the text layer is faster and exact, and it cannot misread a character that is already encoded correctly. Reserve OCR for image-only pages. In a mixed document, process the digital pages as text and OCR only the scanned ones.
Put this into practice with NexusNote
WYSIWYG Markdown, 180MB PDF full-text search in one offline knowledge base, 100 free daily DeepSeek credits, local Ollama, and inline diff polishing.