flutter_web_twain 0.0.1 flutter_web_twain: ^0.0.1 copied to clipboard
A Flutter wrapper for Dynamic Web TWAIN. It provides basic methods for document scan, load and save.
flutter_web_twain #
The Flutter plugin is a wrapper for Dynamsoft's Web TWAIN SDK. It allows you to build web document scanning applications with Flutter.
Getting a License Key for Dynamic Web TWAIN #
Installation #
-
Add
flutter_web_twain
as a dependency in your pubspec.yaml file. -
In the root of your project, download the Dynamic Web TWAIN npm package:
npm install dwt
-
Include the following line in your
index.html
file:<script src="node_modules/dwt/dist/dynamsoft.webtwain.min.js"></script>
Usage #
-
Initialize the Flutter Web TWAIN SDK:
final FlutterWebTwain _flutterWebTwain = FlutterWebTwain(); WebTwainController _controller = await _flutterWebTwain.createWebTwainController(); await _controller!.init('node_modules/dwt/dist/', 'LICENSE-KEY');
-
Embed the image container into your widget tree:
Expanded( child: _controller == null ? const CircularProgressIndicator() : HtmlElementView(viewType: _controller!.webviewId), ),
-
Acquire documents from a document scanner:
await _controller!.scan( '{"IfShowUI": false, "PixelType": ${_pixelFormat!.index}}');
-
Load images from the local file system:
await _controller!.load();
-
Save single or multiple images as PDF, TIFF or JPEG:
await _controller!.download(FileFormat.PDF.index, 'filename');
Try the Example #
cd example
flutter run -d chrome