flutter_genius_scan 0.0.2
flutter_genius_scan: ^0.0.2 copied to clipboard
Flutter plugin for the Genius Scan SDK. It allows scanning paper documents using the camera.
Genius Scan SDK for Flutter #
Description #
This Flutter plugin allows you to access the Genius Scan SDK core features from a Flutter application. The plugin relies on the GSSDKScannerUI library which provides a all-in-one scanner module with simple configurable input.
- Automatic document detection
- Document perspective correction
- Image enhancement with 4 different modes (Grayscale, Color, Black & white, Photo)
- Batch scanning of several pages in row
Licence #
This component is based on the Genius Scan SDK for which you need to setup a licence. You can already try the "demo" version for free by not setting a licence key, the only limitation being that the app will exit after 60 seconds.
To buy a licence or for any question regarding the SDK, please contact us at sdk@thegrizzlylabs.com.
Demo application #
As an example, you can check our demo application
Getting started #
Follow the install steps from https://pub.dev/packages/flutter_genius_scan#-installing-tab-
Additional steps on Android #
- To your app's
android/build.gradle
file, add the flutter-genius-scan library dependency
allprojects {
repositories {
...
flatDir {
dirs "<path to flutter SDK>/.pub-cache/hosted/pub.dartlang.org/flutter_genius_scan//android/libs"
}
}
}
- To your app
android/app/build.gradle
, change minSdkVersion to19
.
Usage #
Set the licence key #
Initialize the SDK with a valid licence key:
FlutterGeniusScan.setLicenceKey('REPLACE_WITH_YOUR_LICENCE_KEY')
setLicenseKey
returns a Future that is resolved if the licence key is valid and rejected if it is not. Note that, for testing purpose, you can also use the plugin without a licence key, but it will only work for 60 seconds.
Start the scanner module #
FlutterGeniusScan.scanWithConfiguration(configuration)
.then((result) {
// Here you can get the pdf file and the scans from the result
// object.
}, onError: (error) => displayError(context, error)
);
The method scanWithConfiguration
takes a configuration
parameter which can take the following options:
source
:camera
orimageUrl
(defaults to camera)sourceImageUrl
: an absolute image url, required ifsource
isimage
. Example:file:///var/…/image.png
multiPage
: boolean (defaults to true). If true, after a page is scanned, a prompt to scan another page will be displayed. If false, a single page will be scanned.defaultFilter
:none
,blackAndWhite
,color
,photo
(by default, the filter is chosen automatically)pdfPageSize
:fit
,a4
,letter
, defaults to fit.postProcessingActions
: an array with the desired actions to display during the post processing screen (defaults to all actions). Possible actions arerotate
,editFilter
.flashButtonHidden
: boolean (default to false)defaultFlashMode
:auto
,on
,off
(default tooff
)foregroundColor
: string representing a color, must start with a#
. The color of the icons, text (defaults to '#ffffff').backgroundColor
: string representing a color, must start with a#
. The color of the toolbar, screen background (defaults to black)highlightColor
: string representing a color, must start with a#
. The color of the image overlays (default to blue)menuColor
: string representing a color, must start with a#
. The color of the menus (defaults to system defaults.)
It returns a Future<Map>
containing:
pdfUrl
: a PDF file of the scanned pages (example: "file://scans
: an array of scan objects. Each scan object has:originalUrl
: The original file as scanned from the camera. "file://enhancedUrl
: The cropped and enhanced file, as processed by the SDK. "file://
FAQ #
What if I get a validation error from App Store Connect? #
You must remove the x86_64 and i386 slices before submitting your application to the App Store. They are only used for the iOS smiulator and iTunes rejects any binary that contains non-ARM slices.
They can stripped out with a script like this one.
What should I do if my license is invalid? #
Make sure you have an ongoing contract with us. Contact us at sdk@thegrizzlylabs.com for any information.