Skip to main content

Using SEPA PayFormScanner | Android Document Scanner

The Scanbot SDK provides the ability to scan and extract content from SEPA pay forms.

The following fields are supported:

  • IBAN
  • BIC
  • Transfer Amount
  • Reference Number
  • Sender IBAN / Name

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

Step 1 - Add PayForm Scanner Feature as a Dependency#

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

api "io.scanbot:sdk-package-3:$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 OCR language blobs and PayForm specific blob files#

The PayForm Scanner is based on the OCR feature of Scanbot SDK. Please check the Optical Character Recognition docs for more details.

In order to use the PayForm Scanner you need to prepare the German and English OCR language files as well as some internal PayForm Recognizer specific blob files. Place the deu.traineddata and eng.traineddata files in the assets sub-folder assets/ocr_blobs/ of your app.

Then on initialization of the SDK call the prepareOCRLanguagesBlobs(true)and the preparePayFormBlobs(true) methods:

import io.scanbot.sdk.ScanbotSDKInitializer
    ...        ScanbotSDKInitializer()        .prepareOCRLanguagesBlobs(true)        .preparePayFormBlobs(true)        ...        .initialize(this)

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

val scanbotSDK = ScanbotSDK(this)val payFormScanner: PayFormScanner = scanbotSDK.createPayFormScanner()val payFormScannerFrameHandler: PayFormScannerFrameHandler = PayFormScannerFrameHandler.attach(cameraView, payFormScanner)

Step 4 - Add result handler for PayFormScannerFrameHandler:#

payFormScannerFrameHandler.addResultHandler { result ->    when (result) {        is FrameHandlerResult.Success -> {            val detectionResult = result.value            if (detectionResult.form != null && detectionResult.form!!.isValid) {                // to do something with result here            }        }        is FrameHandlerResult.Failure -> {        } // handle license error here    }
    false}

handle will be triggered every time PayFormScanner detects a pay form in the camera preview frame or if a license error has occurred. After the pay form detection you have to call payFormScanner.recognizeForm(previewFrame: ByteArray, width: Int, height: Int, orientation: Int). As a result, you will get List<RecognizedField> fields, which is a list of recognized pay form fields (IBAN, BIC, etc).