Dual-Layer Searchable PDF Architecture (ISO 32000-1 & Invisible Font Render Mode 3)
A dual-layer PDF (commonly known as a "Searchable PDF" or "Sandwich PDF") preserves the exact visual fidelity of the original scanned document while synthesizing an invisible, machine-searchable text layer directly aligned over the scan bitmap.
How freeOCR.me Synthesizes Dual-Layer PDFs:
- Bitmap Preservation: The scanned page image is placed as the visible background layer at its native resolution and color space. Stamps, hand-written signatures, physical creases, and official seals remain visually authentic.
- Coordinate Normalization: Neural bounding polygons from the OCR model are transformed from raster pixel dimensions to standard PDF point coordinates (72 points per inch) with sub-pixel alignment:
scale_x = page.rect.width / pix.width,scale_y = page.rect.height / pix.height. - Invisible Text Layer (
render_mode=3): Using ISO 32000-1 compliant font rendering mode 3 ("Neither fill nor stroke text"), character glyphs are positioned with microscopic precision over each matching scanned word. The PDF reader calculates selection bounds and clipboard text without rendering colored pixels, enabling transparent highlight, copy, and search (Ctrl+F) operations. - Word-Level Alignment & Spacing: Standard text insertion operators (
Tj,TJ) combined with character spacing (Tc) and word spacing (Tw) parameters distribute glyph widths to eliminate drift across multi-column documents.
Preprocessing & Layout Heuristics:
- Deskewing via Radon Projections: Calculates skew angles between -15° and +15° across text baselines to rotate pages back to true horizontal alignment before segmentation.
- Adaptive Otsu Binarization: Separates foreground character strokes from paper grain, stains, and ink bleed-through.
- Dual Engine Neural Routing: Single-column linear text routes to CPU workers running OCRmyPDF and Tesseract. Complex multi-column tables, mathematical formulas, and multilingual scripts route to Baidu Unlimited OCR on GPU clusters.