Simple integration with ScanFlow

The scan flow consists of several screens that enable the user to capture and validate each page of its document:

  • a live preview screen to scan the document
  • a review screen where the user validates the scanned file and can optionally adjust the crop area or the filters.

If the multi-page mode is enabled, the user will repeat this interaction until they validate their batch of scan in the camera screen:

The live preview, the review screen, and the recrop screen.

In this guide, you will learn how to integrate this simple scan flow with a few lines of code.

Prerequisites

This guide assumes that you have followed the Getting Started guide :

  • You have integrated the GSKCore.xcframework and GSKScanFlow.xcframework in your app.
  • You have initialized the SDK with the license key.
  • You have configured your app to request proper user permissions.

Start the scan flow

You configure the scan flow with a GSKScanFlowConfiguration object, which let you configure features such as:

  • Source: capture from the camera or import an existing image from the device’s photo library
  • Camera flash mode: you can force the flash to be always on, or only enable it on demand.
  • Multi-page mode: can be enabled or disabled.
  • PDF page size and resolution.
  • Available actions in the post-processing screen.
  • Background and text colors of the different screens.

The API documentation documents all these parameters extensively.

Once the user finishes their scan session, the scan flow returns the list of the scanned pages as images and a PDF file combining all the pages.

Objective-C
GSKScanFlowConfiguration *configuration = [GSKScanFlowConfiguration new];
configuration.multiPage = YES;
GSKScanFlow* scanFlow = [GSKScanFlow scanFlowWithConfiguration:configuration];
[scanFlow startFromViewController:root onSuccess:^(GSKScannerUIResult * _Nonnull result) {
    // Handle result
} failure:^(NSError *error) {
    // Handle error
}];
Swift
let configuration = GSKScanFlowConfiguration()
configuration.multiPage = true
let scanFlow = GSKScanFlow(configuration: configuration)
scanFlow.start(from: viewController, onSuccess: { result in
    // Handle result
}, failure: { error in
    // Handle error
})

and… that’s it!

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