Predefined steps

In this section, I will describe all available steps in the current framework, their configs and will show how they look like.

Right now all steps localized in Russian and English.

DocumentImageScan

Use this step if you want to scan any document image.

Input

  • image: UIImage - document image

  • validateResponse: Bool - If you set this property to true then step will validate DocumentResult, it will check if at least one document type is available

  • startNewSession: Bool - if you are scanning the same document, for example the back page of ID card, please set this to false

Output

DocumentResult struct.

DocumentScan

Use this step if you want to visually scan a document.

Input:

  • documentMask: DocumentMask - you can set a mask for a scan process. We have a set of predefined masks as well you can set the custom one.

  • multipageProcessing: Bool - use the setting to process more than one page of a document for several iterations, f the multipage processing is enabled, the SDK processes the front side of the document, recognizes the document type and checks in the database how many pages should be available for this document type. If there are any child documents (second page, back side) for this document type, the multipage processing is triggered. This concerns scenarios that recognize document types. Default false,

  • multipageAnimationFrontImage: UIImage? - You can set a front image for the multipage animation. If not set, the default image is used

  • multipageAnimationBackImage: UIImage? - You can set a back image for the multipage animation. If not set, the default image is used,

  • multipageButtonBackgroundColor: UIColor? - Set the color for the Skip Page button background.

  • showSkipNextPageButton: Bool - Show/hide the Skip Page button. Default false,

  • cameraFrameDefaultColor: UIColor - Set the color for the document borders in the default state.

  • cameraFrameActiveColor: UIColor - Set the hex color code for the document border in the document detected state.

  • cameraFrameBorderWidth: CGFloat - Set the thickness of the document borders in the video preview.

  • cameraFrameCornerRadius: CGFloat - Change the corners' radius of the camera frame.

  • resultStatusTextFont: UIFont? - Set the text font for the current status.

  • resultStatusTextColor: UIColor - Set the color for the current text status

  • resultStatusBackgroundColor: UIColor - Set the color for the current text status background.

  • resultStatusPositionMultiplier: CGFloat - You can change the location of the result status message. For example, if you set the multiplier to 0.5 and the number of pixels by vertical is equal to 800, your message will be centralized and located at 200 px from top, that is (800 / 2) * 0.5 = 200 px. If the multiplier is equal to 1, the message will be centered. If the multiplier is equal to zero, the default location will be used.

  • doublePageSpread: Bool - Use the setting to process up to two pages of the document (a so-called "double-page spread") in one shot if they are presented on the frame (image).

  • filterDocumentIDList: [Int]? - Set the list of the document IDs to process. If left empty, all documents are processed.

  • showTorchButton: Bool - Show/hide the Torch icon.

  • torchButtonOnImage: UIImage? - Change the Torch icon for ON state

  • torchButtonOffImage: UIImage? - Change the Torch icon for OFF state

  • activityIndicatorColor: UIColor? - Set the color for the loading indicator(s).

Output

DocumentResult struct.

UkrPassportScan

Use this step if you want visually scan a ukrainian old passport first page. The settings for the scanning process adjusted for this document type.

Output

DocumentResult struct.

CaptureWithConfirm

Use this step if you want to visually take a picture of a document and confim it.

Input

  • documentMask: DocumentMask - you can set a mask for a scan process. We have a set of predefined masks as well you can set the custom one.

  • documentType: CaptureDocumentType - you can set a type of the document, mostly used internally

  • scanDocument: Bool - if step should try to scan a document with DocumentImageScan step

  • confirmConfig: DocumentConfirm.Config - config for a DocumentConfirm step

  • docImage: UIImage? - you can pass an image directly to this step as well

  • startNewSession: Bool - if you are scanning the same document, for example the back page of ID card, please set this to false

Output

struct StepResult {
    public let captureResponse: CaptureResponse
    public let docResult: DocumentResult?
    public let confirmResult: DocumentConfirm.StepResult
}
  • captureResponse: CaptureResponse - response with image in base64 format and originalImage.

public struct CaptureResponse: Encodable {
    public let image: String?
    public let originalImage: UIImage?
    public let documentType: CaptureDocumentType
}
  • docResult: DocumentResult - optional DocumentResult value if you decided to scan a document as well

  • confirmResult: DocumentConfirm.StepResult - DocumentConfirm step result.

RfidDocumentScan

Use this step if you want to scan a document with NFC chip.

Input

  • opticalDocResult: DocumentResult - you must pass a DocumentResult from a visual scan from previous step

  • attemptCount: Int - number of attempts, default value is 3

  • config: Config - ui config for this step

struct Config {
    public var retryBtnBackgroundColor: UIColor
    public var retryBtnTintColor: UIColor
    public var skipBtnBackgroundColor: UIColor
    public var skipBtnTintColor: UIColor
}

Output

DocumentResult struct.

SelfieWithConfirm

Use this step if you want to take a person picture with a document and then confirm it.

Output

struct StepResult {
    public let image: UIImage
    public let confirmResult: DocumentConfirm.StepResult
}
  • image: UIImage - the main image

  • confirmResult: DocumentConfirm.StepResult - DocumentConfirm step result.

InnScanWithConfrim

Use this step if you want to scan a ukrainian tax number document.

Input

  • innImage: UIImage? - you can pass an image from a gallery if you want to scan tax number from it

  • confirmConfig: DocumentConfirm.Config - config for a DocumentConfirm step

Output

struct StepResult {
    public let innScanResponse: InnDocumentScanResponse
    public let confirmResult: DocumentConfirm.StepResult
}
  • innScanResponse: InnDocumentScanResponse - a response with image in base64 format, originalImage and a tax number.

public struct InnDocumentScanResponse {
    public let image: String?
    public let originalImage: UIImage?
    public let number: String?
}
  • confirmResult: DocumentConfirm.StepResult - DocumentConfirm step result.

InnConfirm

This is UI step where a customer can visually confirm that the scan was successful or fix an error.

Input

  • config: Config - ui config for this step

struct Config {
    public var title: String
    public var empty_title: String
    public var mainBtnBackgroundColor: UIColor
    public var mainBtnTintColor: UIColor
    public var mainBtnTitle: String
}
  • scanResponse: InnDocumentScanResponse - response from an InnScanWithConfrim step.

Output

  • innScanResponse: InnDocumentScanResponse - a response with image in base64 format, originalImage and a tax number.

public struct InnDocumentScanResponse {
    public let image: String?
    public let originalImage: UIImage?
    public let number: String?
}

BarcodeScan

Use this step if you want to scan a barcode or a qr code.

Input

  • documentMask: DocumentMask - you can set a mask for a scan process. We have a set of predefined masks as well you can set the custom one.

  • shouldParseImage: Bool - if you set it to true then the step will try to return an image of a code.

Output

  • Response struct with an optional image and text fields from a code

public struct Response {
    public let image: UIImage?
    public let fields: [Int: String]
}

CreditCardScan

Use this step if you want to scan a credit card

Input

  • documentMask: DocumentMask - you can set a mask for a scan process. We have a set of predefined masks as well you can set the custom one.

  • shouldParseImage: Bool - if you set it to true then the step will try to return an image of a code.

Output

  • CreditCard struct with an optional image and text fields from a credit card

public struct CreditCard {
    let elapsedTime: Int
    let number: String?
    let fullName: String?
    let expireAt: String?
    let image: UIImage?
}

Last updated