Skip to main content

Using Cheque Scanner | Android Document Scanner

The Scanbot SDK provides the ability to scan and extract content from Cheques.

The following fields are supported:

  • Routing number
  • Account number
  • Cheque number

Try our Cheque Scanner Example App or check the following step by step integration instructions.

Step 1 - Add Cheque Scanner Feature as a Dependency#

ChequeScanner is available with the SDK Package 4. You have to add the following dependency for it:

api "io.scanbot:sdk-package-4:$latestVersion"

It can be used in conjunction with ScanbotCameraView or separately. Let's have a look at an example with ScanbotCameraView.

Step 2 - Prepare the Cheque specific blob files#

In order to use the Cheque Scanner, you need to prepare the internal Cheque Scanner specific blob files.

On initialization of the SDK call the prepareChequeBlobs(true) method:

import io.scanbot.sdk.ScanbotSDKInitializer
    ...        ScanbotSDKInitializer()        .prepareChequeBlobs(true)        ...        .initialize(this)

Step 3 - Get ChequeScanner instance from ScanbotSDK and attach it to ScanbotCameraView#

val scanbotSDK = ScanbotSDK(this)val chequeScanner: ChequeScanner = scanbotSDK.createChequeScanner()val chequeScannerFrameHandler: ChequeScannerFrameHandler = ChequeScannerFrameHandler.attach(cameraView, chequeScanner)

Step 4 - Add result handler for ChequeScannerFrameHandler:#

chequeScannerFrameHandler.addResultHandler(object : ChequeScannerFrameHandler.ResultHandler {    override fun handle(result: FrameHandlerResult<Result, SdkLicenseError>): Boolean {        when (result) {            is FrameHandlerResult.Success -> {                val scannerResult: io.scanbot.chequescanner.model.Result? = (result as FrameHandlerResult.Success<Result?>).value                if (scannerResult != null && (scannerResult.accountNumber.value.isNotEmpty() || scannerResult.routingNumber.value.isNotEmpty())) {                    // to do something with result here                }            }            is FrameHandlerResult.Failure -> {            } // handle license error here        }
        return false    }}

handle will be triggered every time ChequeScanner detects a cheque document in the camera preview frame or if a license error has occurred. After the successful cheque detection you will receive a result in ChequeScannerFrameHandler.ResultHandler callback - you will get io.scanbot.chequescanner.model.Result object, which contains all recognized cheque fields (accountNumber, routingNumber, chequeNumber and raw text data).