flutter_document_scan_sdk

Creator: coderz1093

Last updated:

Add to Cart

Description:

flutter document scan sdk

flutter_document_scan_sdk #
The Flutter plugin is a wrapper for Dynamsoft's Document Normalizer SDK. It enables you to build document rectification applications for Windows, Linux, web, Android and iOS.
Try Document Rectification Example #
Desktop: Windows & Linux #
Windows
cd example
flutter run -d windows
copied to clipboard

Linux
cd example
flutter run -d linux
copied to clipboard

Web #
cd example
flutter run -d chrome
copied to clipboard

Mobile: Android & iOS #
cd example
flutter run
copied to clipboard

Getting a License Key for Dynamsoft Document Normalizer #

Supported Platforms #

Web
Windows
Linux
Android
iOS

Installation #
Add flutter_document_scan_sdk as a dependency in your pubspec.yaml file.
dependencies:
...
flutter_document_scan_sdk:
copied to clipboard
One More Step for Web #
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.12/dist/ddn.js"></script>
copied to clipboard
API Compatibility #



Methods
Android
iOS
Windows
Linux
Web




Future<int?> init(String key)
✔️
✔️
✔️
✔️
✔️


Future<List<DocumentResult>?> detectFile(String file)
✔️
✔️
✔️
✔️
✔️


Future<NormalizedImage?> normalizeFile(String file, dynamic points)
✔️
✔️
✔️
✔️
✔️


Future<int?> setParameters(String params)
✔️
✔️
✔️
✔️
✔️


Future<String?> getParameters()
✔️
✔️
✔️
✔️
✔️


Future<List<DocumentResult>?> detectBuffer(Uint8List bytes, int width, int height, int stride, int format)
✔️
✔️
✔️
✔️
✔️


Future<NormalizedImage?> normalizeBuffer(Uint8List bytes, int width, int height, int stride, int format, dynamic points)
✔️
✔️
✔️
✔️
✔️



Usage #


Initialize the document rectification SDK with a valid license key:
final _flutterDocumentScanSdkPlugin = FlutterDocumentScanSdk();
await _flutterDocumentScanSdkPlugin.init(
"DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==");

await _flutterDocumentScanSdkPlugin.setParameters(Template.grayscale);
copied to clipboard


Do document edge detection and return quadrilaterals:
List<DocumentResult>? detectionResults =
await _flutterDocumentScanSdkPlugin
.detectFile(file);
copied to clipboard


Detect document edges from a buffer:
List<DocumentResult>? detectionResults =
await _flutterDocumentScanSdkPlugin
.detectBuffer(bytes, width, height, stride, format);
copied to clipboard


Rectify the document based on document corners:
NormalizedImage? normalizedImage = await _flutterDocumentScanSdkPlugin.normalizeFile(
file, detectionResults[0].points);
copied to clipboard


Rectify the document based on document corners from a buffer:
NormalizedImage? normalizedImage = await _flutterDocumentScanSdkPlugin.normalizeBuffer(
bytes, width, height, stride, format, detectionResults[0].points);
copied to clipboard


Save the rectified document image to a file:
if (normalizedUiImage != null) {
const String mimeType = 'image/png';
ByteData? data = await normalizedUiImage!
.toByteData(format: ui.ImageByteFormat.png);
if (data != null) {
final XFile imageFile = XFile.fromData(
data.buffer.asUint8List(),
mimeType: mimeType,
);
await imageFile.saveTo(path);
}
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.