Skip to main content

emon 0.3.0-preview.5 copy "emon: ^0.3.0-preview.5" to clipboard
emon: ^0.3.0-preview.5 copied to clipboard

PDF and image to semantic HTML and JSON, with OCR that just works: the emon core, the platform's OCR adapters, and model packs fetched on demand.

emon #

PDF and image to semantic HTML and JSON, with OCR that works on this platform out of the box. The pure-Dart turnkey of emon: emon_core, plus the OCR adapters of each platform, plus the defaults of emon's turnkey table. For Flutter apps use emon_flutter (it adds ML Kit on Android and a ChangeNotifier for pack downloads).

import 'package:emon/emon.dart';

final emon = await openEmon();
final model = await emon.convert(EmonInput.file('scan.pdf'));
print(await model.html());
await emon.close();
  • Windows.Media.Ocr is the default engine on Windows (the OS reads, nothing is downloaded) and Tesseract elsewhere (emon_flutter makes ML Kit the Android default); Apple Vision (iOS, macOS), and Tesseract on Windows, are selected with ConvertOptions(ocrEngine: ...) or openEmon(engine: ...).
  • Language models are packs, fetched on first use over the platform's own HTTPS stack, verified against a SHA-256 catalogue, and cached. emon.engines(), emon.prepare(), emon.packs.ensure(), onPackNeeded and emon.packs.events let app code decide what is downloaded and show progress. EMON_OFFLINE=1 or packs: PackMode.never fetches nothing.
  • Conversions still use a PDF's usable embedded text if OCR cannot run. When an OCR failure leaves the entire document unread, conversion throws an EmonError with the available failure details.
  • dart run example/main.dart --engine vision scan.pdf out.html.

On the web #

The same API runs on Flutter web and Dart web over emon's wasm build and the JS SDK: pass web: WebAssets(...) (see emon_core's README) to openEmon. Nothing is downloaded by the library on the web, and tesseract.js loads its own models from where you serve them.

0
likes
0
points
323
downloads

Publisher

verified publisher3sln.com

Weekly Downloads

PDF and image to semantic HTML and JSON, with OCR that just works: the emon core, the platform's OCR adapters, and model packs fetched on demand.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

emon_core, emon_ocr_ppocr, emon_ocr_tesseract, emon_ocr_vision, emon_ocr_winocr

More

Packages that depend on emon