EHIC Scanner UI Components | iOS Document Scanner
The Scanbot SDK provides the ability to recognize European health insurance cards (EHIC), a.k.a. elektronische Gesundheitkarten(eGK).
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 the OCR language files
please refer to the OCR section.
EHIC Scanner UI
There are two ways to integrate the component into the application:
- Ready to use UI component (more about RTU UI)
- Classic UI component (more about Classic components)
Please be aware that processing really large images may lead to out-of-memory crashes on iOS. Since this limit is highly dynamic and untransparent in iOS, depending on the device, your app's current memory usage, the other running apps, the iOS version, the system configuration and many other unknown variables, we did not add a hard limit for image sizes.
As a general rule of thumb, it is quite safe to assume that processing images of the resolution the camera can shoot will most likely not crash your app. On most modern iOS devices this currently translates to 12 megapixels. But even much larger images may work without crashing as well.
Thus we cannot take responsibility for out-of-memory crashes when dealing with very high-resolution images. It is your responsibility, as an app developer, to properly manage the handling of large images and keep the memory footprint of your app as small as possible.
In case you have any questions on this topic, please reach out to our support team.
Please do not use multiple scanners at the same time. For example, do not combine generic document scanner, health insurance scanner, text data scanner, etc. at the same time! Each scanner instance requires a lot of memory, GPU, and processor resources. Using multiple scanners will lead to performance issues for the entire application.
Ready-To-Use UI Component
The main class of the Ready-To-Use UI (RTU UI) component is SBSDKUIHealthInsuranceCardScannerViewController
.
Usually this view controller is used as a separate screen for scanning European health insurance cards in a UIImage
or CMSampleBufferRef
.
It returns the recognition results in a delegate method.
While you don't have direct control of the actual scanner view controller you can use the
SBSDKUIHealthInsuranceCardScannerConfiguration
to customize it in a variety of ways, such as colors, texts and behavior.
- Swift
- Objective-C
import UIKit
import ScanbotSDK
class EHICScannerUISwiftViewController: 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 = SBSDKUIHealthInsuranceCardScannerConfiguration.defaultConfiguration
// Behavior configuration:
// e.g. turn on the flashlight.
configuration.behaviorConfiguration.isFlashEnabled = true
// UI configuration:
// e.g. configure various colors.
configuration.uiConfiguration.topBarButtonsColor = UIColor.white
configuration.uiConfiguration.topBarBackgroundColor = UIColor.red
// Text configuration:
// e.g. customize some UI elements' text.
configuration.textConfiguration.flashButtonTitle = "Flash"
configuration.textConfiguration.cancelButtonTitle = "Cancel"
// Present the recognizer view controller modally on this view controller.
SBSDKUIHealthInsuranceCardScannerViewController.present(on: self,
configuration: configuration,
delegate: self)
}
}
extension EHICScannerUISwiftViewController: SBSDKUIHealthInsuranceCardScannerViewControllerDelegate {
func healthInsuranceCardDetectionViewController(_ viewController: SBSDKUIHealthInsuranceCardScannerViewController,
didDetectCard card: SBSDKHealthInsuranceCardRecognitionResult) {
// Process the detected card.
}
}
#import "EHICScannerUIObjcViewController.h"
@import ScanbotSDK;
@interface EHICScannerUIObjcViewController () <SBSDKUIHealthInsuranceCardScannerViewControllerDelegate>
@end
@implementation EHICScannerUIObjcViewController
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// Start scanning here. Usually this is an action triggered by some button or menu.
[self startScanning];
}
- (void)startScanning {
// Create the default configuration object.
SBSDKUIHealthInsuranceCardScannerConfiguration *configuration = [SBSDKUIHealthInsuranceCardScannerConfiguration defaultConfiguration];
// Behavior configuration:
// e.g. turn on the flashlight.
configuration.behaviorConfiguration.isFlashEnabled = YES;
// UI configuration:
// e.g. configure various colors.
configuration.uiConfiguration.topBarButtonsColor = [UIColor whiteColor];
configuration.uiConfiguration.topBarBackgroundColor = [UIColor redColor];
// Text configuration:
// e.g. customize some UI elements' text.
configuration.textConfiguration.flashButtonTitle = @"Flash";
configuration.textConfiguration.cancelButtonTitle = @"Cancel";
// Present the recognizer view controller modally on this view controller.
[SBSDKUIHealthInsuranceCardScannerViewController presentOn:self
configuration:configuration
delegate:self];
}
- (void)healthInsuranceCardDetectionViewController:(SBSDKUIHealthInsuranceCardScannerViewController *)viewController
didDetectCard:(SBSDKHealthInsuranceCardRecognitionResult *)card {
// Process the detected card.
}
@end
Classic UI Component
The main class of the Classical UI component is SBSDKHealthInsuranceCardScannerViewController.
Usually this view controller is embedded as a child view controller into another view controller, the parent view controller. The parent view controller usually acts as the delegate and processes the recognition results. You still have full control over the UI elements and can add additional views and buttons to your view controller. The classical component does not display results, instead it just forwards them to the delegate.
- Swift
- Objective-C
import UIKit
import ScanbotSDK
class EHICScannerSwiftViewController: UIViewController {
// The instance of the recognition view controller.
private var scannerViewController: SBSDKHealthInsuranceCardScannerViewController?
override func viewDidLoad() {
super.viewDidLoad()
// Create the SBSDKHealthInsuranceCardScannerViewController instance.
self.scannerViewController = SBSDKHealthInsuranceCardScannerViewController(parentViewController: self,
parentView: self.view,
delegate: self)
}
}
extension EHICScannerSwiftViewController: SBSDKHealthInsuranceCardScannerViewControllerDelegate {
func healthInsuranceCardScannerViewController(_ viewController: SBSDKHealthInsuranceCardScannerViewController,
didScanHealthInsuranceCard card: SBSDKHealthInsuranceCardRecognitionResult) {
// Process the recognized result.
}
}
#import "EHICScannerObjcViewController.h"
@import ScanbotSDK;
@interface EHICScannerObjcViewController () <SBSDKHealthInsuranceCardScannerViewControllerDelegate>
// The instance of the recognition view controller.
@property (nonatomic, strong) SBSDKHealthInsuranceCardScannerViewController *scannerController;
@end
@implementation EHICScannerObjcViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Create the SBSDKHealthInsuranceCardScannerViewController instance.
self.scannerController =
[[SBSDKHealthInsuranceCardScannerViewController alloc] initWithParentViewController:self
parentView:self.view
delegate:self];
}
- (void)healthInsuranceCardScannerViewController:(nonnull SBSDKHealthInsuranceCardScannerViewController *)viewController
didScanHealthInsuranceCard:(nonnull SBSDKHealthInsuranceCardRecognitionResult *)card {
// Process the recognized result.
}
@end
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get your free Trial LicenseWhat do you think of this documentation?
What can we do to improve it? Please be as detailed as you like.