Bonoscan.Components.Client 0.34.0
Bonoscan.Components.Client
In-browser scan engine for Bonoscan.Components
(Blazor WebAssembly / .NET MAUI Blazor Hybrid): DocAligner detection on onnxruntime-web + a pure-C#
warp, all in the browser. For Blazor Server use
Bonoscan.Components.Server.
The model, onnxruntime-web, and the detection Web Worker ship inside this package and are served
from the app bundle (_content/Bonoscan.Components.Client/) — no model to host, no CDN, no runtime
downloads. Live detection runs off the UI thread inside the worker, so it works fully offline,
including in a packaged MAUI app.
Nothing external is pulled in for detection: the contract — RgbImage, DetectionParameters,
DetectionResult, IAsyncDocumentDetector — comes from Bonoscan.Components, and
BrowserDocAlignerDetector in this package is the binding over the bundled JS module, sharing the
one worker the viewfinder already loads.
Install
<!-- nuget.config -->
<add key="bonoscan-local" value="/abs/path/to/scanner/local-feed" />
<PackageReference Include="Bonoscan.Components.Client" Version="0.30.0" />
Use
// Program.cs / MauiProgram.cs
builder.Services.AddBonoscanClient(o =>
{
o.GuideAspect = 0.707;
o.CaptureWidth = 2480;
o.CaptureHeight = 3508;
o.Mime = "image/jpeg";
o.Quality = 0.92;
});
<!-- host index.html -->
<link rel="stylesheet" href="_content/Bonoscan.Components/bonoscan.css" />
<DocumentScanner OnCaptured="r => _bytes = r.Bytes" />
See Bonoscan.Components for the full component /
ScannerOptions / theming reference. AddBonoscanClient registers the shared ScannerOptions and an
IScannerEngineFactory. Neither the engine nor its BrowserDocAlignerDetector is a container-tracked
service: each scanner creates its own pair and disposes both, so mounting the scanner repeatedly can
neither accumulate dead engines nor pin a detection worker for the lifetime of the app.
The worker itself is shared by the page and reference-counted inside docaligner-ort.js — created on
the first claim, terminated when the last is released. Stopping or resetting a scanner keeps the claim,
so a retake does not reload the model; disposing the scanner gives it back.
MAUI camera access
getUserMedia needs the OS permission and the WebView's permission gate:
- Android —
<uses-permission android:name="android.permission.CAMERA" />, runtimePermissions.RequestAsync<Permissions.Camera>(), and grantRESOURCE_VIDEO_CAPTUREin the WebView'sWebChromeClient.OnPermissionRequest. - iOS / Mac Catalyst —
NSCameraUsageDescriptioninInfo.plist. Verify on a real device: WKWebViewgetUserMediafrom MAUI's custom scheme can need extra config. - Windows — allow the WebView2
PermissionRequested(camera).
Detection runtime (MAUI)
Live detection runs in a Web Worker inside the WebView — the worker, onnxruntime-web, and the model
are all bundled and served from the app (_content/Bonoscan.Components.Client/), so it stays fully
offline; nothing is fetched at runtime. Verify on a real device: Android WebView / WKWebView / WebView2 support Web Workers, but worker
creation from the BlazorWebView virtual origin should be confirmed per platform. WebGPU is usually
unavailable in mobile WebViews, so inference falls back to the bundled WASM EP; multi-threaded WASM needs
cross-origin isolation (COOP/COEP) that a BlazorWebView host generally doesn't set, so it runs
single-threaded in the worker (still off the UI thread).
Licensing
Library code MIT. Bundled assets: onnxruntime-web (MIT, Microsoft) and the DocAligner weights (Apache-2.0, DocsaidLab/DocAligner).
No packages depend on Bonoscan.Components.Client.
.NET 10.0
- Bonoscan.Components (>= 0.34.0)
| Version | Downloads | Last updated |
|---|---|---|
| 0.34.0 | 0 | 11/10/2026 |