Skip to main content

EHIC Scanner | Cordova Document Scanner

The EHIC Scanner is able to scan and extract content from the backside of the European Health Insurance Card (EHIC).

alt text

Integrating the EHIC Scanner UI#

The EHIC 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 OCR language files please refer to the OCR section.

Use the plugin API method ScanbotSdk.UI.startEHICScanner() to start the EHIC Scanner UI.

import ScanbotSdk, { HealthInsuranceCardScannerConfiguration } from 'cordova-plugin-scanbot-sdk';
private SDK = ScanbotSdk.promisify();
// Always make sure you have a valid license on runtime via SDK.getLicenseInfo()if (!licenseCheckMethod()) { return; }
const configs: HealthInsuranceCardScannerConfiguration = {  // Customize colors, text resources, behavior, etc..  finderTextHint: 'Please hold your phone over the back of your Health Insurance Card.',  orientationLockMode: 'PORTRAIT',  // see further configs ...};
const result = await this.SDK.UI.startEHICScanner({uiConfigs: configs});
if (result.status === 'CANCELED') {  // user has canceled the scanning operation  return;}
// handle the extracted data fields// result.ehicResult.fields[n]......

Handling the Result#

The result object contains the following fields:

  • status: 'OK' if EHIC data was extracted, 'CANCELED' if the user canceled the operation (tapped on the "cancel" button).
  • ehicResult.fields[]: An array of EHIC fields. Each field is an object with the following properties:
    • field.type - the field type
    • field.value - the value of the field
    • field.confidence - confidence in the accuracy of value

Customization#

The UI and the behavior of the EHIC Scanner can be customized by passing the configs value via HealthInsuranceCardScannerConfiguration. All configuration options are optional.

export interface HealthInsuranceCardScannerConfiguration{    /**     * Orientation lock mode of the UI and the camera preview.     * By default the orientation is not locked.     */    orientationLockMode?: CameraOrientationMode;    /**     * Foreground color of the flash button when flash is on.     */    bottomButtonsActiveColor?: string;    /**     * Foreground color of the flash button when flash is off.     */    bottomButtonsInactiveColor?: string;    /**     * Background color of the detection overlay.     */    cameraOverlayColor?: string;    /**     * Whether the cancel button is hidden or not.     */    cancelButtonHidden?: boolean;    /**     * String being displayed on the cancel button.     */    cancelButtonTitle?: string;    /**     * The receivers delegate.     */    delegate?: any;    /**     * String being displayed when health insurance card was not found.     */    detectionStatusFailedDetectionText?: string;    /**     * String being displayed when health insurance card was found but not recognized.     */    detectionStatusFailedValidationText?: string;    /**     * String being displayed when health insurance card was found and recognized.     */    detectionStatusSuccessText?: string;    /**     * Foreground color of the detection overlay.     */    finderLineColor?: string;    /**     * Width of finder frame border. Default is 2.     */    finderLineWidth?: number;    /**     * String being displayed as description.     */    finderTextHint?: string;    /**     * Foreground color of the description label.     */    finderTextHintColor?: string;    /**     * String being displayed on the flash button.     */    flashButtonTitle?: string;    /**     * Whether flash is toggled on or off.     */    flashEnabled?: boolean;    /**     * Enables or disables the machine readable zones detection.     */    recognitionEnabled?: boolean;    /**     * Background color of the top bar.     */    topBarBackgroundColor?: string;    /**     * Foreground color of the cancel button.     */    topBarButtonsColor?: string;    /**     * The type of health insurance card validation.     */    validationType?: HealthInsuranceCardValidationType;    /**     * Controls whether buttons should use all capitals style, as defined by the Android Material Design. Defaults to TRUE.     * Android only.     */    useButtonsAllCaps?: boolean;}