@spartaficial/spart-desk-ocr-paddle
PaddleOCR's PP-OCRv6 as a text reader for SPART-Desk, for when the recognizer built into Windows misreads: bitmap fonts, Delphi forms, painted grids, selected or coloured text. This page is for anyone whose application shows text the Windows reader gets wrong: when to add this reader, how to configure it, and what the package carries.
The models and ONNX Runtime's native build for Windows x64 and Arm64 ship
inside the package, so it works as soon as it is installed: no Python, no
GPU, no download at run time, and one dependency (onnxruntime-common).
It is optional. SPART-Desk reads the screen with the recognizer built into
Windows unless you pass this one.
npm i @spartaficial/spart-desk-ocr-paddle
Recommended: behind the Windows reader, so it reads only what Windows missed.
import { createWindowsOcrProvider, Desktop } from "@spartaficial/spart-desk";
import { createPaddleOcrProvider } from "@spartaficial/spart-desk-ocr-paddle";
await using desktop = await Desktop.create({
ocr: { provider: [createWindowsOcrProvider(), createPaddleOcrProvider({ characters: "latin" })] },
});
const app = await desktop.launch({ executable: "C:\\Apps\\Legacy.exe" });
const main = app.window();
await main.getByOcr("B2").click();
Or on its own: ocr: { provider: createPaddleOcrProvider() }.
A configuration file can name it instead of importing it, with the package
installed next to SPART-Desk: ocr: { provider: ["windows", "paddle"] }. The
name stands for createPaddleOcrProvider() made with ocr.paddle, its
options:
export default defineConfig({
ocr: { provider: ["windows", "paddle"], paddle: { model: "v6-small", characters: "latin" } },
});
The engine does not read panes and button faces a second time with this reader, as it does for Windows' recognizer: PaddleOCR reads small text in a whole window as well as in a crop of it, and every extra read costs time. The second read of short labels side by side still runs.
When to use it
PaddleOCR reads better than the Windows recognizer and is slower, so it earns
its place where Windows misreads, and behind it most of all: listed after the
Windows reader it reads only the texts Windows missed, and the two together
read more than either (over 99% of the texts of a set of real windows across
Windows Forms, WPF, Win32, MFC, VCL, Swing, Qt, Avalonia, WinUI 3, Flutter
and Electron). Bitmap fonts such as MS Sans Serif, Delphi VCL forms and a
DPI-unaware window that Windows stretched are where it matters most. The
engine reads the screen only when the accessibility tree does not answer, so
the cost is paid only there. Its recognizer reads 50 languages, Chinese and
Japanese among them; for applications in a Latin-script language,
characters: "latin" keeps an icon from being read as a character of
another script.
Each word carries a confidence, and ocr.minimumConfidence (default 0.5)
applies to it. Its few misreads are mostly confident ones, so a higher
threshold buys little. See resolution.md for how
readers are tried in order.
ONNX Runtime in the package
The package carries ONNX Runtime's native build for Windows x64 and Arm64, its CPU files only, as Microsoft signs them (about 59 MB); it carries no WebAssembly build. It installs on those two platforms only; 32-bit Windows has no Node.js 24 to run SPART-Desk on.
Languages
PaddleOCR reads the languages PP-OCRv6 reads: English, the other
Latin-script languages (Dutch among them), Chinese and Japanese. It has no
language setting, and a locator's language and ocr.languages are for the
Windows reader. Behind the Windows reader, it is where English is read on a
machine without the English recognizer.
Options
createPaddleOcrProvider(options?: PaddleOcrOptions), where PaddleOcrOptions
is { model?, characters?, threads?, maxSide?, detection?, batch? }:
model: aPaddleModel,"v6-small"(default), the most accurate, or"v6-tiny", about twice as fast. PP-OCRv6 medium is not shipped.characters:"all"(default) or"latin": Latin letters, digits, punctuation and symbols only, for applications in a Latin-script language.threads: ONNX Runtime's threads, a whole number (default: half the processors, at most 8), per reader.maxSide: the longest side handed to the detector; larger pictures are shrunk first (default 4096).detection: the detector's thresholds, aDetectionOptions; PP-OCRv6's own are the default:threshold(0.2, the probability above which a pixel is text),boxThreshold(0.4, the mean probability a region needs),unclipRatio(1.4, how far a region is grown back) andminSize(3, the pixels below which a region is noise).batch: lines read in one run of the recognizer (default 8).
Model files
The package carries PP-OCRv6 tiny and small (37 MB) in ONNX, as PaddlePaddle
publishes them on Hugging Face under the Apache License 2.0
(LICENSE-APACHE-2.0.txt), each pinned to a revision and a SHA-256. ONNX
Runtime is Microsoft's, under the MIT License (LICENSE-ONNXRUNTIME.txt).
Both notices are also in
third-party notices.