This guide explains how to build a simple scan flow with two lines of code. It demonstrates how to use each platform’s UI module to start a document capture, which allows the user to scan a multipage document and generate a PDF document
The scan flow consists of 3 screens that enable the user to capture and validate each page of its document:
Camera screen
Edit border screen
Post-processing screen
If you use a cross-platform framework such as ReactNative or Flutter, you can find additional details in the plugins’ documentation.
Include the ScannerUI
and the Core
subspecs in your Podfile:
pod 'GSSDK/Core', :podspec => 'https://s3.amazonaws.com/tgl.geniusscan.sdk/GSSDK-3.0.27.podspec'
pod 'GSSDK/ScannerUI', :podspec => 'https://s3.amazonaws.com/tgl.geniusscan.sdk/GSSDK-3.0.27.podspec'
See the iOS integration guide for more details.
Add the following code to your app’s build.gradle
:
repositories {
...
maven { url 'https://s3.amazonaws.com/tgl.maven' }
}
dependencies {
...
implementation 'com.thegrizzlylabs.geniusscan.sdk:gs-sdk-ui:3.0.27'
}
The Genius Scan SDK is subject to a commercial license: a license key is needed to initialize the SDK. The key contains your application identifier (aka. bundle ID) and the license’s expiration date. Please contact us if you don’t have a license key yet.
If the key is invalid or your license is expired, the initialization will fail, and the SDK will not work. A good practice is to check if the initialization succeeds; if not, you can take an appropriate workaround (e.g.: disable the feature, prompt the user to update the application).
if (![GSK initWithLicenseKey:@"<YOUR LICENSE KEY>"]) {
// The license is expired or invalid
}
try {
GeniusScanLibrary.init(getApplicationContext(), "<YOUR LICENSE KEY>");
} catch (RuntimeException e) {
// The license is expired or invalid
}
You can configure the scan flow to capture a single page or several pages in a row. You configure the scan flow with several parameters such as:
Once the user is done scanning its pages, the scan flow returns the list of scanned pages as images and a PDF file combining all the pages.
GSKScannerUIConfiguration *configuration = [GSKScannerUIConfiguration new];
configuration.multiPage = YES;
GSKScannerUI* scanner = [GSKScannerUI scannerUIWithConfiguration:configuration];
[scanner startFromViewController:root onSuccess:^(GSKScannerUIResult * _Nonnull result) {
// Handle result
} failure:^(NSError *error) {
// Handle error
}];
let configuration = GSKScannerUIConfiguration()
configuration.multiPage = true
scanner = GSKScannerUI(configuration: configuration)
scanner.start(from: viewController, onSuccess: { result in
// Handle result
}, failure: { error in
// Handle error
})
ScanConfiguration scanConfiguration = new ScanConfiguration();
scanConfiguration.multiPage = true;
GeniusScanSdkUI.scanWithConfiguration(context, scanConfiguration);
© 2023 The Grizzly Labs. All rights reserved.