Skip to content

Function: createRapidOcr() ​

ts
function createRapidOcr(opts?): Promise<OcrEngine & AsyncDisposable>;

Defined in: src/helpers/ocr/rapidOcr.ts:46

Default OCR engine: the RapidOCR stack (PaddleOCR PP-OCR models on ONNX Runtime) through the optional peer dependencies ppu-paddle-ocr and onnxruntime-node. Models are downloaded and cached on first use.

Create one engine and pass it as ocr to reuse the loaded models across documents; release them with dispose(), or let await using do it:

ts
await using ocr = await createRapidOcr();
for (const buf of pdfs) await toMarkdown(buf, { tableStrategy: "pixels", ocr });

Parameters ​

opts? ​

RapidOcrOptions = {}

Returns ​

Promise<OcrEngine & AsyncDisposable>

AGPL-3.0-or-later — inherited from PyMuPDF and pymupdf4llm.