Skip to main content

PDF OCR

Extract selectable text from scanned PDFs, parse tabular grids, and assemble searchable sandwich PDFs across 16 languages directly in your browser using WebAssembly.

PDF OCR — Interactive Browser WorkspaceExtract selectable text from scanned PDFs, parse tabular grids, and assemble searchable sandwich PDFs across 16 languages directly in your browser using WebAssembly.
100% Client-Side • Zero Server Upload
Sample Input / Parameters — Converting Scanned Invoices
Upload: invoice_scan.pdf (1 page)
Mode: Text Extract
Language: English
Ready locally via WebAssembly & JavaScript
Expected Output / Live Result
invoice_scan_extracted.txt (extracted copyable text with billing address and values)
100% Client-Side • Zero Server Upload

Portable Document Format files fall into two distinct categories: digital-native documents storing glyph streams alongside embedded font tables, and scanned PDFs where each page is a compressed JPEG, JBIG2, or CCITT Group 4 image wrapped inside a page container. Standard copy-paste and desktop search fail on scanned files because no character codes exist in the content stream—only pixels. NexusCalculator's PDF OCR engine bridges that gap inside your browser by pairing PDF.js rasterization, canvas preprocessing, Tesseract.js WebAssembly LSTM inference, and pdf-lib coordinate projection, keeping sensitive medical, financial, or legal scans local to your device.

If your PDF already holds selectable fonts and you only need raw paragraphs without neural recognition, use PDF to Text instead.

From Pixel Buffers to Selectable Glyphs

Because Tesseract reads raster bitmaps rather than PDF vector operators, the browser pipeline renders each target page to an off-screen HTML5 <canvas> first. PDF.js decodes the compressed image XObjects at a configurable viewport multiplier: 1.5x for Balanced or Fast passes and 2.2x for Max detail passes.

Before pixels reach the WebAssembly recognizer, two deterministic filters clean degraded paper scans directly on the ImageData RGBA array:

  • Auto-Contrast Stretching: Multiplies RGB deviation from midpoint 128 by a 1.6 gain—clamp(1.6 * (c - 128) + 128, 0, 255)—deepening faint ink while pushing off-white backgrounds toward pure white.
  • Luminance Binarization: Converts RGB pixels using ITU-R BT.601 luma weights (Y = 0.299R + 0.587G + 0.114B) and thresholds above 130 to 255 (white) and at or below 130 to 0 (black), removing shadow gradients and bleed-through noise.

A dedicated Web Worker then instantiates Tesseract.js with the concatenated language string (such as eng+deu or eng+chi_sim). Modern Tesseract 4/5 engines evaluate each text line through a bidirectional Long Short-Term Memory (LSTM) recurrent neural network, using sequence context to disambiguate homoglyphs like 0 versus O, or 1, l, and I.

OCR Modes, Resolution Scaling, and Language Trade-Offs

Choosing the right viewport scale, accuracy profile, and preprocessing filter depends on scan quality, typography, and script family. Higher raster scales enlarge small serif glyphs so ascenders stay distinct, though memory usage and inference time scale quadratically with the viewport multiplier.

Configuration AxisOptionTechnical BehaviorBest-Fit ScenarioKnown Caveat
Accuracy ProfileFast1.5x canvas scale; tessedit_ocr_engine_mode = 1High-contrast modern laser prints at 300+ DPILower recall on degraded photocopies or skewed lines
Accuracy ProfileBalanced1.5x canvas scale; default LSTM recognitionGeneral business contracts, invoices, multi-script PDFsVery small footnotes (< 8 pt) may drop punctuation
Accuracy ProfileMax2.2x canvas scale; strict ASCII character whitelistDense English/numeric ledgers, serial codes, small printWhitelist strips accented Latin, Cyrillic, Arabic, and CJK
PreprocessingAuto-ContrastLinear 1.6x RGB contrast stretch around 128Faint toner, light pencil notes, low-contrast mobile scansCan amplify dark paper specks on noisy backgrounds
PreprocessingBinarizationBT.601 luma threshold at 130 (pure black/white)Aged yellow paper, uneven book-spine shadowsErases very light watermarked or colored text
Output ModeSearchable PDFDraws zero-opacity words onto original PDF pagesArchival compliance, Ctrl+F search, visual fidelityOutput retains original raster size unless compressed

Projecting Bounding Boxes onto ISO 32000 User Space

Generating a searchable sandwich PDF requires translating coordinates between two opposing geometric conventions. HTML5 Canvas and Tesseract return word bounding boxes { x0, y0, x1, y1 } measured in raster pixels from a top-left origin, whereas ISO 32000 PDF user space places (0, 0) at the bottom-left corner of the page measured in PostScript points (1 pt = 1/72 inch).

During recognition, every word box is first divided by the canvas rendering scale so coordinates normalize back to the PDF page's native point dimensions. When compiling the final PDF with pdf-lib, the vertical axis flips using the page height:

// Normalize Tesseract raster pixel bbox back to ISO 32000 PDF point space
const wordHeight = word.bbox.y1 - word.bbox.y0;
const pdfX = word.bbox.x0;
const pdfY = pageHeight - word.bbox.y0 - wordHeight;

// Overlay selectable text with zero opacity over the original raster scan
page.drawText(word.text, {
  x: pdfX,
  y: pdfY,
  size: Math.max(2, wordHeight * 0.82),
  opacity: 0,
});

In lower-level PDF content streams, desktop tools like Ghostscript or ocrmypdf accomplish the same invisible sandwich effect using text rendering mode 3 Tr (neither fill nor stroke) inside a BT ... ET text object. Because the original scan image remains untouched beneath the text overlay, handwritten signatures, corporate stamps, and complex charts stay visually identical to the paper source. If you photographed paper pages on a phone first, assemble them cleanly with Scan to PDF before running OCR, and shrink oversized multi-page searchable archives afterward using Compress PDF.

Diagnosing Recognition Errors and CLI Cross-Checks

When per-page confidence drops below 80%, the root cause is almost always upstream image geometry rather than the neural weights:

  • Sub-150 DPI Scans and JPEG Ringing: Characters shorter than roughly 20 pixels in cap height lack enough stroke pixels for LSTM feature extraction. Rescanning at 300 DPI grayscale (avoiding aggressive JPEG compression) usually lifts accuracy from ~72% to 98%+.
  • Script Mismatch with Max Mode: Because Max mode restricts recognition to printable ASCII characters, switch back to Balanced whenever processing accented European text (spa, fra, deu), right-to-left Arabic (ara), Indic scripts (hin, ben), or East Asian scripts (chi_sim, chi_tra, jpn, kor).
  • Multi-Language Stacking Overhead: Selecting four or five languages simultaneously expands the LSTM search beam and slows inference significantly. Stack only the exact two languages present on the page (for example eng+fra).

Developers validating OCR pipelines or automating large server-side archives can benchmark browser results against native desktop CLI tooling:

# Rasterize page 1 at 300 DPI and run Tesseract with TSV confidence output
pdftoppm -png -r 300 -f 1 -l 1 scanned.pdf page
tesseract page-1.png stdout -l eng --psm 3 tsv | head -n 15

# Verify whether a searchable PDF actually contains an embedded text stream
pdftotext searchable_output.pdf - | head -n 20

For quick ad-hoc verification without CLI installation, simply open the downloaded searchable PDF in any modern browser, press Ctrl+F (or Cmd+F), and highlight a phrase directly across the scanned pixels—if the highlight rectangle hugs the printed words accurately, your coordinate projection and text layer succeeded.

How to Use PDF OCR

1

Drop your scanned PDF into the workspace or browse locally; enter the password if the document is encrypted.

2

Pick one or more document languages (for example English plus French) to load the matching LSTM traineddata dictionaries.

3

Choose your output workflow (Text Extract, Searchable PDF, or Table mode) and select Fast, Balanced, or Max accuracy.

4

Configure Auto-Contrast or Binarization preprocessing and restrict processing to specific page ranges if needed.

5

Click Run OCR to rasterize pages via PDF.js and recognize characters locally inside the browser worker.

6

Inspect recognized text alongside the original page preview, review confidence scores, and download TXT, CSV, JSON, or your searchable PDF.

Real Examples

Converting Scanned Invoices

Extract text and billing details from a paper scan.

Input
Upload: invoice_scan.pdf (1 page)
Mode: Text Extract
Language: English
Output
invoice_scan_extracted.txt (extracted copyable text with billing address and values)

Creating Searchable Records

Convert a scanned contract scan into a searchable archive.

Input
Upload: contract_scan.pdf (5 pages)
Mode: Searchable PDF
Language: English, Spanish
Output
contract_scan_searchable.pdf (5 pages: visual images with interactive selectable text overlay)

Frequently Asked Questions

How does a searchable PDF preserve the original scan while allowing text selection?
A searchable (sandwich) PDF retains each original raster page as the visible background and overlays recognized words at their exact bounding-box coordinates using zero-opacity text operators. Viewers display the authentic scan while Ctrl+F search, copy-paste, and screen readers operate on the invisible foreground text layer.
What is the difference between Balanced and Max accuracy modes during PDF OCR?
Balanced mode rasterizes pages at 1.5x viewport scale (roughly 108 to 150 DPI equivalent) with default LSTM recognition for faster throughput. Max mode upsamples pages to 2.2x scale and applies an ASCII character whitelist, which improves small-print Latin text fidelity but should be avoided for non-Latin scripts such as Arabic, Bengali, or CJK.
When should I enable Binarization instead of Auto-Contrast preprocessing?
Use Auto-Contrast for clean gray-toned scans with faint ink, as it stretches pixel luminance linearly around the midpoint without discarding subtle antialiasing. Switch to Binarization when scanning yellowed paper, uneven shadows, or photocopy bleed-through that confuses glyph segmentation.
Can this OCR tool process password-protected scanned PDFs without uploading them?
Yes. When an encrypted PDF is detected, the tool prompts for the document password and decrypts the byte buffer locally in memory before passing the pages to PDF.js and the Tesseract.js WebAssembly worker. Neither the file nor the password ever leaves your device.
Why does the first OCR run pause briefly before recognizing page one?
On first execution for a given language, the browser downloads the Tesseract WebAssembly binary and the compressed LSTM traineddata dictionary for your selected language codes (for example eng or deu) and caches them locally. Subsequent runs reuse those cached models immediately.

Key Features

  • Client-side Tesseract.js WebAssembly LSTM recognition with zero server uploads
  • Searchable sandwich PDF assembly overlaying invisible text via pdf-lib coordinate projection
  • Multi-language recognition across 16 scripts with combined language stacking (such as eng+spa)
  • Canvas preprocessing filters for ITU-R BT.601 grayscale binarization and 1.6x linear contrast boost
  • Targeted page processing supporting all pages, visual selection checkboxes, or custom page ranges
  • Local password decryption plus side-by-side confidence scoring and TXT, CSV, or JSON export

Common Use Cases

  • Converting scanned legal discovery bundles and court exhibits into Ctrl+F searchable archives without violating client confidentiality
  • Extracting line items and totals from photographed vendor invoices or paper receipts into structured text and CSV rows
  • Digitizing bilingual academic papers or archival monographs using stacked multi-language Tesseract models
  • Making legacy engineering manuals and hardware schematics searchable on local tablets or air-gapped workstations
  • Auditing OCR quality page-by-page using per-page confidence percentages before ingesting documents into enterprise search indexes
  • Running targeted OCR on specific appendix pages of a 200-page scanned report to conserve memory and processing time

Explore More Tools in This Category

View All Developer & Utility Tools

PDF to Word Converter

Convert static PDF files into editable Microsoft Word (DOCX) documents directly inside your browser. Reconstructs headings, paragraphs, bullet lists, tables, and scanned pages with zero server uploads.

Word to PDF Converter

Convert Microsoft Word documents (DOCX and DOC) into fixed-layout, print-ready PDF files directly inside your browser while preserving typography, tables, and embedded media.

Excel to PDF Converter

Convert Microsoft Excel workbooks (XLSX and XLS) into paginated, print-ready PDF reports in your browser with multi-sheet selection, scaling controls, and formula auditing.

PowerPoint to PDF Converter

Convert PowerPoint (.pptx) slide decks into high-resolution, print-ready PDF documents in your browser with N-up handout grids, speaker notes, and custom slide ranges.

Image to PDF

Convert JPG, PNG, WebP, GIF, and BMP images into print-ready PDF documents locally in your browser with page layout controls, watermarks, compression, and live PDF.js preview.

PDF to Excel Converter — Extract Tables to XLSX & CSV

Extract tabular data from PDF bank statements, financial reports, and invoices into structured Microsoft Excel (.xlsx) workbooks or RFC 4180 CSV files directly inside your browser.

PDF to PowerPoint Converter — Editable PPTX Presentation Generator

Transform static PDF slide decks and handouts into Microsoft PowerPoint (.pptx) presentations locally in your browser with editable text reconstruction, 2.5x raster fidelity mode, custom branding, and OCR.

PDF to HTML Converter

Convert static PDF documents into clean, semantic HTML5 or coordinate-accurate web markup directly in your browser. Inspect live output inside a sandboxed preview, copy raw code, or download standalone HTML and ZIP archives.