flutter_document_scan_sdk 0.1.0
flutter_document_scan_sdk: ^0.1.0 copied to clipboard
A Flutter wrapper for Dynamsoft Document Normalizer, providing API for document edge detection and normalization.
flutter_document_scan_sdk #
The Flutter plugin is a wrapper for Dynamsoft's Document Normalizer SDK. It allows you to do document edge detection and normalization.
Getting a License Key for Dynamsoft Document Normalizer #
Supported Platforms #
- Web
Installation #
-
Add
flutter_document_scan_sdk
as a dependency in yourpubspec.yaml
file.dependencies: ... flutter_document_scan_sdk:
-
Include the JavaScript library of Dynamsoft Document Normalizer in your
index.html
file:<script src="https://cdn.jsdelivr.net/npm/dynamsoft-document-normalizer@1.0.11/dist/ddn.js"></script>
Usage #
-
Initialize the document normalizer SDK with resource path and license key:
final _flutterDocumentScanSdkPlugin = FlutterDocumentScanSdk(); await _flutterDocumentScanSdkPlugin.init( "https://cdn.jsdelivr.net/npm/dynamsoft-document-normalizer@1.0.11/dist/", "DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ=="); await _flutterDocumentScanSdkPlugin.setParameters(Template.grayscale);
-
Do document edge detection and return quadrilaterals:
List<DocumentResult> detectionResults = await _flutterDocumentScanSdkPlugin .detect(file);
-
Normalize the document based on four corner coordinates:
NormalizedImage? normalizedImage = await _flutterDocumentScanSdkPlugin.normalize( file, detectionResults[0].points);
-
Save the document to the local disk:
await _flutterDocumentScanSdkPlugin .save('normalized.png');
Try the Example #
cd example
flutter run -d chrome