Introduction

A document-processing pipeline that runs entirely in the browser — PDF rendering, text detection, OCR and entity recognition, with nothing uploaded.

@stabrise/scaledp reads PDFs and images in the browser. PDF rendering, text detection, OCR and named-entity recognition compose into one pipeline, and inference runs on onnxruntime-web over WebAssembly or WebGPU.

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, and no document ever leaves the browser, which is the point for anything sensitive.

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 rows = await new Pipeline([
    new PdfToImage({ resolution: 300 }),
    new PaddleTextRecognizer({ keepFormatting: true }),
    new GlinerNer({ labels: ['person', 'organization', 'email', 'phone'] }),
]).transform(file)
Run this on your own file

Where to start

What it is not

It is not a hosted API, and it is not a wrapper around one. Everything runs in the tab, which sets the shape of the trade-offs: models are downloaded once and cached, the first run of a pipeline is slower than the tenth, and a 1.2 GB model is a real cost rather than someone else's problem. Those constraints are documented rather than hidden — see Models and caching.

It also does not attempt to be the Python library. Several ScaleDP stages have no browser equivalent because their engines have no browser build, and a few Python behaviours are deliberately not reproduced. Both lists are in Porting from Python ScaleDP.

License

AGPL-3.0-or-later, matching the Python library. Contact StabRise for commercial licensing.

On this page