Skip to main content

Document Data Extractor UI Components | iOS Document Scanner

The Scanbot SDK provides the ability to detect various types of documents on the image, crop them, and extract the fields' data via the Document Data Extractor.

Currently, the Document Data Extractor supports the following types of documents:

  • German ID Card
  • German Passport
  • German Driver's License
  • German Residence Permit
  • German Health Insurance Card (front side)
  • European Health Insurance Card

As a result of scanning, the user gets the SBSDKGenericDocument object, if the result of the scanning was successful. SBSDKGenericDocument is a hierarchically structured type that contains the document's type, eventually a list of child documents, total recognition confidence, and a list of the document's fields. Each field is represented by the SBSDKGenericDocumentField class, holding the field's type, a cropped image of the field, the recognized text and the field's recognition confidence.

For convenience and user interface-related tasks, the SBSDKGenericDocument can be flattened using the functions flatDocument(includeEmptyChildren:includeEmptyFields:) and allFields(includeEmptyFields:). Alternatively, it can be wrapped into a document's type-specific subclass of SBSDKGenericDocumentWrapper using the function wrap().

The Document Data Extractor also allows the exclusion of specific fields from the extraction process. When configured, these fields will not be extracted, which can be beneficial for security and privacy purposes. Refer to the excludedFieldTypes property in SBSDKDocumentDataExtractorConfigurationBuilder, the fieldExcludeList property in SBSDKDocumentDataExtractorConfiguration, and the excludedFieldTypes property in SBSDKUIDocumentDataExtractorBehaviorConfiguration. These properties accept an array of normalized names for the document field types, such as SBSDKGenericDocumentDeIdCardFrontPINFieldNormalizedName.

Currently, the following document wrappers exist:

  • SBSDKDocumentsModelDeIdCardFront - German ID card front side
  • SBSDKDocumentsModelDeIdCardBack - German ID card back side
  • SBSDKDocumentsModelDePassport - German passport
  • SBSDKDocumentsModelDeDriverLicenseFront - German driver's license front side
  • SBSDKDocumentsModelDeDriverLicenseBack - German driver's license back side
  • SBSDKDocumentsModelDeResidencePermitFront - German residence permit front side
  • SBSDKDocumentsModelDeResidencePermitBack - German residence permit back side
  • SBSDKDocumentsModelDeHealthInsuranceCardFront - German health insurance card front side
  • SBSDKDocumentsModelEuropeanHealthInsuranceCard - European health insurance card

Document Data Extractor UI

There are two ways to integrate the component into the application:

danger

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.

caution

Please do not use multiple scanners at the same time. For example, do not combine Document Data Extractor, Health Insurance Scanner, Text Pattern 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

alt text

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

Typically, this view controller is used as a dedicated screen for extracting generic documents. It displays the extracted results in an expandable table view while the extractor continues to process the document to further refine the results. The SBSDKUIDocumentDataExtractorViewControllerDelegate also supports scanning both sides of a document, such as the front and back of an ID card, within a single screen. Once the user is satisfied with the results, they can press the submit button, which dismisses the extractor view controller and passes the results to its delegate.

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

RTU UI Example
loading...

Classic UI Component

The main class of this Classic UI component is SBSDKDocumentDataExtractorViewController.

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 scanning results. You still have full control over the UI elements and can add additional views and buttons to your view controller. The Classic component does not display results, instead, it just forwards them to the delegate.

Classic UI Example
loading...

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get your free Trial License

What do you think of this documentation?