Skip to main content

Using EHIC Scanner | Android Document Scanner

The Scanbot SDK provides the ability to scan and extract content from European Health Insurance Cards (EHIC), a.k.a. elektronische Gesundheitskarten (eGK).

The following fields are supported:


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

Step 1 - Add EHIC Scanner Feature as a Dependency#

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

api "io.scanbot:sdk-package-3:$latestVersion"api "io.scanbot:sdk-ehic-assets:$latestSdkVersion"

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#

The EHIC 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 EHIC Scanner you need to prepare the German and English OCR language files as well as some internal EHIC 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) method:

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

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

val scanbotSDK = new ScanbotSDK(this)val healthInsuranceCardScanner = scanbotSDK.createHealthInsuranceCardScanner()val hicScannerFrameHandler = HealthInsuranceCardScannerFrameHandler.attach(cameraView, healthInsuranceCardScanner)

Step 4 - Add result handler for HealthInsuranceCardScannerFrameHandler:#

hicScannerFrameHandler.addResultHandler(object : HealthInsuranceCardScannerFrameHandler.ResultHandler {    override fun handle(result: FrameHandlerResult<HealthInsuranceCardRecognitionResult?, SdkLicenseError>): Boolean {        when (result) {            is FrameHandlerResult.Success -> {                val detectionResult = result.value                if (detectionResult?.status == HealthInsuranceCardDetectionStatus.SUCCESS) {                    // do something with result here                }            }            is FrameHandlerResult.Failure -> {
            } // handle license error here        }
        return false    }})

handle will be triggered every time HealthInsuranceCardScanner detects a health insurance card in the camera preview frame or if a license error has occurred. You will get List<HealthInsuranceCardField> fields, which is a list of recognized EHIC fields.