Simple scanner guide

Introduction

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 Cordova, ReactNative or Flutter, you can find additional details in the plugins’ documentation.

Setup

iOS

Include the ScanFlow and the Core subspecs in your Podfile:

pod 'GSSDK/Core', :podspec => 'https://s3.amazonaws.com/tgl.geniusscan.sdk/GSSDK-<VERSION>.podspec'
pod 'GSSDK/ScanFlow', :podspec => 'https://s3.amazonaws.com/tgl.geniusscan.sdk/GSSDK-<VERSION>.podspec'

See the iOS integration guide for more details.

Android

Add the following code to your app’s build.gradle:

repositories {
   ...
   maven { url 'https://s3.amazonaws.com/tgl.maven' }
}

dependencies {
  ...
  implementation 'com.geniusscansdk:gssdk-scanflow:<VERSION>'
}

Licensing

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).

iOS

if (![GSK initWithLicenseKey:@"<YOUR LICENSE KEY>"]) {
   // The license is expired or invalid
}

Android

try {
   GeniusScanLibrary.init(getApplicationContext(), "<YOUR LICENSE KEY>");
} catch (RuntimeException e) {
   // The license is expired or invalid
}

Start the scan flow

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.

iOS (Objective-C)

GSKScanFlowConfiguration *configuration = [GSKScanFlowConfiguration new];
configuration.multiPage = YES;
GSKScanFlow* scanner = [GSKScanFlow scanFlowWithConfiguration:configuration];
[scanner startFromViewController:root onSuccess:^(GSKScanFlowResult * _Nonnull result) {
    // Handle result
} failure:^(NSError *error) {
    // Handle error
}];

iOS (Swift)

let configuration = GSKScanFlowConfiguration()
configuration.multiPage = true
scanner = GSKScanFlow(configuration: configuration)
scanner.start(from: viewController, onSuccess: { result in
    // Handle result
}, failure: { error in
    // Handle error
})

Android

ScanConfiguration scanConfiguration = new ScanConfiguration();
scanConfiguration.multiPage = true;
ScanFlow.scanWithConfiguration(context, scanConfiguration);

© 2010 The Grizzly Labs, Inc. All rights reserved.