Skip to main content

SEPA Payform Scanner | iOS Document Scanner

The SBSDKPayFormScanner class provides the functionality to detect and recognize SEPA payforms. It extracts relevant information fields by performing optical text recognition on certain areas of the image, e.g. IBAN, BIC, receiver, amount of money and reference.

For performance reasons the scanner is divided into two parts: detection and recognition. The detection only tests whether the scanned image contains a payform or not. The recognizer performs the text extraction and fills the fields.

The common usage is to configure the iPhone's camera for full HD video capturing and run the detection part on each incoming frame synchronously in the video capture queue. When the detector returns a positive result the recognizing part runs on the same full HD frame in the same video capture queue and returns the recognizer's result.

The SEPA Payform Scanner is based on the OCR feature and thus requires the proper installation of the OCR language files deu.traineddata and eng.traineddata (aka. blob files). For more details on how to set up the OCR language files please refer to the OCR section.

You can integrate the component into the application using:

Ready-To-Use UI Component#

The main class of the Ready-To-Use UI (RTU UI) component is SBSDKUIWorkflowScannerViewController.

Usually this view controller is used as a separate screen for scanning various scanning scenarios e.g. Payform scanning.

While you don't have direct control of the actual scanner view controller you can use the SBSDKUIWorkflowScannerConfiguration to customize it in a variety of ways, such as colors, texts and behavior.

import UIKitimport ScanbotSDK
class PayformScanWorkflowUISwiftViewController: UIViewController {
    override func viewDidAppear(_ animated: Bool) {        super.viewDidAppear(animated)
        // Start scanning here. Usually this is an action triggered by some button or menu.        self.startScanning()    }
    func startScanning() {
        // Create the default configuration object.        let configuration = SBSDKUIWorkflowScannerConfiguration.default()
        // Behavior configuration:        // e.g. enable a beep sound on successful detection.        configuration.behaviorConfiguration.isSuccessBeepEnabled = true
        // UI configuration:        // e.g. configure various colors.        configuration.uiConfiguration.topBarBackgroundColor =        configuration.uiConfiguration.topBarButtonsActiveColor = UIColor.white        configuration.uiConfiguration.topBarButtonsInactiveColor = UIColor.white.withAlphaComponent(0.3)
        // Text configuration:        // e.g. customize a UI element's text.        configuration.textConfiguration.cancelButtonTitle = "Cancel"
        // Create a workflow step for payform scanning.        let workflowStep = SBSDKUIScanPayFormWorkflowStep(title: "Scan payform",                                                          message: "Please scan your payform",                                                          wantsCapturedPage: false) { result in            // Process the result of the workflow step.            if let payform = result.payformResult, payform.recognitionSuccessful {
                // Return nil if a payform was found and recognized.                return nil            }
            // Handle the error if no payform was found or recognized.            return NSError(domain: "PayformErrorDomain",                           code: 2,                           userInfo: [NSLocalizedDescriptionKey: "This does not seem to be a valid payform."])        }
        // Create a workflow using a payform workflow step.        let workflow = SBSDKUIWorkflow(steps: [workflowStep],                                       name: "Payform",                                       validationHandler: nil)
        // Present the recognizer view controller modally on this view controller.        SBSDKUIWorkflowScannerViewController.present(on: self,                                                     workflow: workflow!,                                                     configuration: configuration,                                                     delegate: self)    }}
extension PayformScanWorkflowUISwiftViewController: SBSDKUIWorkflowScannerViewControllerDelegate {    func workflowScanViewController(_ viewController: SBSDKUIWorkflowScannerViewController,                                    didFinish workflow: SBSDKUIWorkflow,                                    with results: [SBSDKUIWorkflowStepResult]) {        // Process the result of the workflow.    }}