@stabrise/scaledp

Process a document without sending it anywhere.

Document pipelines that run in the browser. PDF rendering, text detection, OCR and entity recognition compose into one pipeline and run on WebAssembly or WebGPU — in the tab. The file never leaves the machine, which is the point for anything sensitive.

npm install @stabrise/scaledp

The same pipeline, minus the cluster

It mirrors the ScaleDP Python library — same stages, same parameter names, same schemas — so a pipeline reads the same in both. What differs is the runtime: no Spark, no server.

Porting from Python ScaleDP
import { Pipeline, configure } from '@stabrise/scaledp'
import { PdfToImage } from '@stabrise/scaledp/pdf'
import { PaddleTextRecognizer } from '@stabrise/scaledp/ocr'
import { GlinerNer } from '@stabrise/scaledp/ner'

configure({ cache: 'indexeddb', pdf: { workerSrc: '/pdf.worker.min.mjs' } })

const pipeline = new Pipeline([
    new PdfToImage({ resolution: 300 }),
    new PaddleTextRecognizer({ preset: 'v6-small', keepFormatting: true }),
    new GlinerNer({ labels: ['person', 'organization', 'email', 'phone'] }),
])

const rows = await pipeline.transform(file)

Choosing an OCR engine

EngineBox levelModels fetchedWebGPUNotes
PaddleOCRword~6 MByes13 language presets, best all-rounder
DBNet ONNXword~5 MByesDetection only; mirrors ScaleDP server-side
Tesseractword~15 MB / langnoNo ONNX; good for clean Latin scans

One bad page is one bad page

Every output schema carries an exception field. A stage that fails records the message there and the pipeline continues, so one unreadable scan does not lose the other forty. Pass propagateError: true to opt into throwing.

The error contract