Skip to main content

emon 0.3.0-preview.8 copy "emon: ^0.3.0-preview.8" to clipboard
emon: ^0.3.0-preview.8 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();
  • The default OCR engines are Windows.Media.Ocr on Windows, Apple Vision on iOS and macOS, and Tesseract on Linux. Standalone Dart on Android uses Tesseract when the app enables it. Flutter on Android uses ML Kit through emon_flutter. Enable native engines with the adapter's bundle build-hook option or supply a NativeAdapter to openEmon.
  • 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
160
points
323
downloads

Documentation

API reference

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
Contributing

License

MIT (license)

Dependencies

emon_core, emon_ocr_ppocr, emon_ocr_tesseract, emon_ocr_vision, emon_ocr_winocr

More

Packages that depend on emon