Skip to main content

Barcode Scanner | Android Barcode Scanner

Ready To Use UI Components

The Ready-To-Use UI (RTU UI) is a set of easy to integrate and customize high-level UI components (Activities) for the most common tasks in the Scanbot Barcode Scanner SDK:

  • Barcode and QR-Code Scanner - BarcodeScannerActivity

alt text

  • Batch Barcode and QR-Code Scanner - BatchBarcodeScannerActivity

alt text

The design and behavior of these ready-to-use Activities are based on our many years of experience as well as the feedback from our SDK customers.

Customization of RTU UI

  • UI: All colors and text resources (localization).
  • Behavior: Enable or disable features like Flashlight, Barcode Filter, Image Snapping.

Please note: The main idea of the RTU UI is to provide simple-to-integrate and simple-to-customize Activity components. Due to this idea, there are some limitations with the possibilities of customization. If you need more customization options you have to implement custom Activities using our "Classic SDK UI Components".

Integration of RTU UI

Dependencies

The RTU UI components are distributed as a separate package scanbot-barcode-scanner-sdk-ui. Add it as a dependency to your project:

implementation("io.scanbot:scanbot-barcode-scanner-sdk-ui:$scanbotSdkVersion")

Get the latest $scanbotBarcodeSdkVersion from the Changelog.

Start RTU UI Activity and process result

To start the RTU UI barcode scanner you only have to start the relevant activity and be ready to process its result later.

info

Starting from version 3.0.8, the SDK RTU components contain predefined AndroidX Result API contracts. They handle part of the boilerplate for starting the RTU activity component and mapping the result once it finishes.

If your code is bundled with Android's deprecated startActivityForResult API - check the other approach we offer for this case.

private val barcodeScanningResult = registerForActivityResult(BarcodeScannerActivity.ResultContract()) { resultEntity ->
if (resultEntity.resultOk) {
presentResult(result = resultEntity)
}
}

private val batchBarcodeScanningResult = registerForActivityResult(BatchBarcodeScannerActivity.ResultContract()) { resultEntity ->
if (resultEntity.resultOk) {
presentResult(batchResult = resultEntity)
}
}

myButton.setOnClickListener {
val barcodeCameraConfiguration = BarcodeScannerConfiguration()
barcodeCameraConfiguration.setFlashEnabled(true)
barcodeCameraConfiguration.setCancelButtonTitle("Cancel")
barcodeCameraConfiguration.setFinderLineColor(Color.GREEN)
barcodeCameraConfiguration.setBarcodeFormatsFilter(...)
// set further config properties ...

barcodeScanningResult.launch(barcodeCameraConfiguration)
}

myButtonBatch.setOnClickListener {
val input = BatchBarcodeScannerActivity.InputParams(BatchBarcodeScannerConfiguration())
batchBarcodeScanningResult.launch(input)
}
info

All parameters in BarcodeScannerConfiguration and BatchBarcodeScannerConfiguration are optional.

Full API references for these methods can be found on BarcodeScannerConfiguration page, BatchBarcodeScannerConfiguration page and CommonBarcodeScannerConfiguration page.

info

We offer some syntactic sugar for handling the result from RTU components via AndroidX Result API:

  • every RTU component's activity contains a Result class which, in turn, along with the resultCode value exposes a Boolean resultOk property. This will be true if resultCode equals Activity.RESULT_OK;

  • when you only expect Activity.RESULT_OK result code - you can use the AppCompatActivity.registerForActivityResultOk extension method instead of registerForActivityResult - it will be triggered only when there is a non-nullable result entity present.

caution

Always use the corresponding activity's static newIntent method to create intent when starting the RTU UI activity using deprecated startActivityForResult approach. Creating android.content.Intent object using its constructor (passing the activity's class as a parameter) will lead to the RTU UI component malfunctioning.

Additional RTU barcode scanning parameters

Please see chapter Additional configuration below to see some additional parameter descriptions.

Full Example of the RTU UI Activity

Please see a full example implementation in our demo.

Classic SDK Components

Our Classic UI Components allow you to build your own flexible and fully customizable UI components. These building blocks are easy to integrate and customize and can be used in your Activities to implement barcode scanning functionality.

Customization

  • UI: Fully customizable
  • Behavior: Fully customizable

Integration of Classic SDK Components

Use the class BarcodeScannerView which incapsulates the Barcode Scanning feature in one UI component. When using the BarcodeScannerView component, it is not required to work directly with the Camera view or to set up a finder view separately. Simply follow the steps below and you are ready to go.

To start using the barcode feature, add the following view into your layout xml:

    <io.scanbot.sdk.barcode.ui.BarcodeScannerView
android:id="@+id/barcode_scanner_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />

Then configure the view using the following calls:

barcodeScannerView = findViewById(R.id.barcode_scanner_view)
val barcodeDetector = ScanbotBarcodeScannerSDK(this).createBarcodeDetector()
barcodeDetector.modifyConfig {
// set the supported barcode formats here
setBarcodeFormats(BarcodeFormat.COMMON_CODES)
setSaveCameraPreviewFrame(false)
}
// both calls initCamera and initDetectionBehavior are required
barcodeScannerView.apply {
initCamera(CameraUiSettings(false))
initDetectionBehavior(barcodeDetector,
{ result ->
if (result is FrameHandlerResult.Success) {
// process the scanned result here
handleSuccess(result)
}
false
},
object : IBarcodeScannerViewCallback {
override fun onCameraOpen() {
barcodeScannerView.viewController.useFlash(flashEnabled)
}
override fun onPictureTaken(image: ByteArray, captureInfo: CaptureInfo) {
// process the full size images taken by BarcodeAutoSnappingController here
// to enable auto snapping use the following command:
// barcodeScannerView.viewController.autoSnappingEnabled = true
}
}
)
}

Delegate the methods onResume and onPause in your Activity class (or Fragment) to BarcodeScannerView:

class MyActivity : AppCompatActivity() {

...

override fun onResume() {
super.onResume()
barcodeScannerView.viewController.onResume()
}

override fun onPause() {
super.onPause()
barcodeScannerView.viewController.onPause()
}
}

It is possible to configure the finder view using the following commands:

// To disable the finder view
barcodeScannerView.finderViewController.setFinderEnabled(false)
// To set the required aspect ratio
barcodeScannerView.finderViewController.setRequiredAspectRatios(listOf(FinderAspectRatio(4.0, 1.0)))

You may also configure the camera or the behavior of the scanner using the corresponding configuration controllers:

// To switch to the front camera
barcodeScannerView.cameraConfiguration.setCameraModule(CameraModule.FRONT)
// To call the take picture function of the Camera
barcodeScannerView.viewController.takePicture()

Classic components: alternative approach

Instead of using a single BarcodeScannerView, to get more flexibility you may also use the classes ScanbotCameraXView, BarcodeDetectorFrameHandler, ScanbotBarcodeDetector, BarcodeScannerConfig and BarcodeAutoSnappingController to build a custom scanner UI for Barcode and QR-Code scanning.

ScanbotCameraXView

The Android camera API might seem to be very tricky and far from being developer-friendly (in fact, very far). To help you avoid the same issues which we have encountered while developing the Scanbot SDK, we created the ScanbotCameraXView.

Add it to your layout, which is as simple as:

    <io.scanbot.sdk.ui.camera.ScanbotCameraXView
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="match_parent" />

Delegate the methods onResume and onPause in your Activity class (or Fragment) to ScanbotCameraXView:

class MyActivity : AppCompatActivity() {

...

override fun onResume() {
super.onResume()
cameraView?.onResume()
}

override fun onPause() {
super.onPause()
cameraView?.onPause()
}
}

That is it! You can start your app and you should see the camera preview.

Preview Mode

The ScanbotCameraXView supports 2 preview modes:

  • CameraPreviewMode.FIT_IN - in this mode the camera preview frames will be downscaled to the layout view size. Full preview frame content will be visible, but unused edges could appear in the preview layout.
  • CameraPreviewMode.FILL_IN - in this mode the camera preview frames fill the layout view. The preview frames may contain additional content at the edges that is not visible in the preview layout.

By default, ScanbotCameraXView uses FILL_IN mode. You can change it using the cameraView.setPreviewMode(CameraPreviewMode mode) method.

Autofocus Sound and Shutter Sound

You can enable/disable autofocus event system and shutter sounds using setters in ScanbotCameraXView.

cameraView.setCameraOpenCallback(new CameraOpenCallback() {
@Override
public void onCameraOpened() {
cameraView.postDelayed(new Runnable() {
@Override
public void run() {
cameraView.setAutoFocusSound(false);
cameraView.setShutterSound(false);
}
}, 700);
}
});

cameraView.setShutterSound(boolean enabled) sets the camera shutter sound state. By default - true, the camera plays the system-defined camera shutter sound when takePicture() is called.

Note that devices may not always allow disabling the camera shutter sound. If the shutter sound state cannot be set to the desired value, this method will be ignored. https://developer.android.com/reference/android/hardware/Camera.html#enableShutterSound(boolean)

Continuous Focus Mode

For most use cases it is recommended to enable the "Continuous Focus Mode" of the Camera. Use the continuousFocus() method of ScanbotCameraXView for this. It should be called from the main thread and only when the camera is opened (CameraOpenCallback):

cameraView = (ScanbotCameraXView) findViewById(R.id.camera);
cameraView.setCameraOpenCallback(new CameraOpenCallback() {
@Override
public void onCameraOpened() {
cameraView.postDelayed(new Runnable() {
@Override
public void run() {
cameraView.continuousFocus();
}
}, 700);
}
});

Please note: The Continuous Focus Mode will be automatically disabled

  • after the autoFocus method call,
  • after a tap on the ScanbotCameraXView to perform the autoFocus,
  • or after the takePicture event.

In these cases you have to call the continuousFocus() method again to re-enable the Continuous Focus Mode.

Orientation Lock

By default the ScanbotCameraXView will create pictures with their orientation based on the current device orientation. It is important to understand that the orientation of the taken picture is independent of the locked orientation mode of the Activity!

For example: if you just lock the Activity to portrait mode, the orientation of the taken image will still be based on the current device orientation!

To apply a real orientation lock in ScanbotCameraXView, you can use the following methods: cameraView.lockToLandscape(boolean lockPicture) or cameraView.lockToPortrait(boolean lockPicture) to lock the Activity and the taken picture to a desired orientation:

@Override
protected void onCreate(Bundle savedInstanceState) {
// ...

cameraView = (ScanbotCameraXView) findViewById(R.id.camera);

// Lock the orientation of the Activity as well as the orientation of the taken picture to portrait:
cameraView.lockToPortrait(true);

// ...
}

User Guidance

To improve both the end user's experience and scanning quality you can add visual guidance to the scanning UI.

This will help the user understand the desired positioning, orientation, and size of the scanned document or the QR/barcodes in the camera preview and take care of the preliminary processing to improve the results.

General idea

In your layout put your finder view on top of ScanbotCameraXView within the same parent, and specify its id to ScanbotCameraXView using app:finder_view_id="@id/my_finder_view_id" attribute:

<io.scanbot.sdk.ui.camera.ScanbotCameraXView
android:id="@+id/cameraView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:finder_view_id="@id/my_finder_view_id" />

<io.scanbot.sdk.ui.camera.FinderOverlayView
android:id="@+id/my_finder_view_id"
android:layout_width="match_parent"
android:layout_height="match_parent" />

Alternatively, you can just set id as android:id="@+id/finder_overlay" for your finder view and ScanbotCameraXView will find it automatically.

Please note the following limitations when using finder view:

  • the parent view should not have any padding. ScanbotCameraXView should have android:layout_width="match_parent" and android:layout_height="match_parent" layout parameters and no padding or margins;
  • the "Finder Overlay" view can have any margins, size, background or even child views, but it should always be over the camera preview frame, otherwise it will throw an IllegalStateException.

Not only will this direct the user's scanning process, but also the FrameHandler (attached to the given ScanbotCameraXView) will receive a non-null FrameHandler.Frame.finderRect object that will represent the frame area within the view finder's bounds. That can later be used, for example, for other SDK components that accept finder rect.

To start with: bare android.view.View (full customization)

In case you want full control over the look and feel of the view finder - you can use any android.view.View subclass as a finder view. Take this example:

<io.scanbot.sdk.ui.camera.ScanbotCameraXView
android:id="@+id/camera_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:finder_view_id="@id/my_finder_view" />

<View
android:id="@+id/my_finder_view"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_gravity="bottom"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="200dp"
android:background="@drawable/finder_view_container_bg" />

where @drawable/finder_view_container_bg is your xml-drawable with bounds outline. The result might look like this:

this.

FinderOverlayView - ready-to-use solution

Instead of plain android.view.View you can use our specially made FinderOverlayView class. It handles all the hassle and leaves you with just a little bit of styling. Take this example:


<io.scanbot.sdk.ui.camera.ScanbotCameraXView
android:id="@+id/camera_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:finder_view_id="@id/my_finder_view"/>

<io.scanbot.sdk.ui.camera.FinderOverlayView
android:id="@+id/my_finder_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

This component allows the following customizations:

  • overlay_color - the color of the area outside the finder view gap
  • overlay_stroke_color - the color of the finder view border
  • stroke_width - the width of the finder view border
  • sbsdk_corner_radius - the radius for rounded corners of the finder view border
  • min_padding - the minimum space between the finder view and the screen borders
  • fixed_width - the finder view's fixed width
  • fixed_height - the finder view's fixed height
  • max_size - maximum size of the longer side, when fixed sizes are not set

Alternatively, if you do not want to specify a fixed width and height, you can programmatically set the desired finder view aspect ratio. It will then take all the available screen space, respecting given aspect ratio and padding:

val requiredPageAspectRatios = listOf(FinderAspectRatio(21.0, 29.7)) // ~ A4 page size

...

val finderOverlayView = findViewById<FinderOverlayView>(R.id.finder_overlay_view)
finderOverlayView.setRequiredAspectRatios(requiredPageAspectRatios)

The result might look like this:

this.

To set the padding from the edge of the preview (this means that the padding will not be calculated from the edge of the screen, but rather from the edge of the preview itself), use finderInsets API. Check both CameraPreviewMode.FIT_IN and CameraPreviewMode.FILL_IN to see the difference. To set all insets:

val finderOverlayView = findViewById<FinderOverlayView>(R.id.finder_overlay_view)
finderOverlayView.finderInsets = Insets.of(50, 200, 50, 0)
...

To set one inset:

val finderOverlayView = findViewById<FinderOverlayView>(R.id.finder_overlay_view)
finderOverlayView.setFinderInset(right=50)
...

There is also an option to create a safe area for the finder. This means that if some part of the preview is in this area, the finder will be moved out of this zone. For example, you can set the top safe area inset as the height of the toolbar to prevent your finder appearing behind the toolbar, even if the camera and finder layouts are placed behind the toolbar in the view stack.

To set all safe area insets:

val finderOverlayView = findViewById<FinderOverlayView>(R.id.finder_overlay_view)
finderOverlayView.safeAreaInsets = Insets.of(0, 200, 0, 0)
...

To set one safe area inset:

val finderOverlayView = findViewById<FinderOverlayView>(R.id.finder_overlay_view)
finderOverlayView.setSafeAreaInsets(top=200)
...

AdaptiveFinderOverlayView - for range of desired aspect ratios

In case you are scanning different documents with different acceptable aspect ratios, but still want to preserve the logic of having a pre-selected rectangle of the document - you might use AdaptiveFinderOverlayView.

Take this example:


<io.scanbot.sdk.ui.camera.ScanbotCameraXView
android:id="@+id/camera_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:finder_view_id="@id/my_finder_view"/>

<io.scanbot.sdk.ui.camera.AdaptiveFinderOverlayView
android:id="@+id/my_finder_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

AdaptiveFinderOverlayView uses ContourDetectorFrameHandler in its logic, so we also need to set that up:

val cameraView = findViewById<ScanbotCameraXView>(R.id.camera_view)
val finderOverlayView = findViewById<AdaptiveFinderOverlayView>(R.id.my_finder_view)

// we can use several aspect ratios:
val pageAspectRatios = listOf( // this will be used for ContourDetectorFrameHandler
PageAspectRatio(21.0, 29.7), // a4 sheet size
PageAspectRatio(85.60, 53.98)) // credit card size
val finderAspectRatios = pageAspectRatios.toFinderAspectRatios() // for AdaptiveFinderOverlayView
myFinderOverlayView.setRequiredAspectRatios(finderAspectRatios)

val contourDetectorFrameHandler = ContourDetectorFrameHandler.attach(cameraView, scanbotSDK.createContourDetector())
contourDetectorFrameHandler.setRequiredAspectRatios(pageAspectRatios)
contourDetectorFrameHandler.addResultHandler(finderOverlayView.contourDetectorFrameHandler)

Now during live detection the finder view will adjust its borders to a detected document if it complies to one of the aspect ratios set.

Inserting views into finder sections

It is now possible to correctly layout some content within the finder. Both AdaptiveFinderOverlayView and FinderOverlayView have 3 sections where it is possible to insert a view. All inserted views can be matched to the size of the section, so it is possible to build custom constraints inside each of them. For this we need to place your view in xml with a special id.

First, just add it to the view hierarchy as you would do with any other finder view mentioned above:

  • finder_top_placeholder - for a container that will be placed above the finder frame.
  • finder_center_placeholder - for a container that will be placed inside the finder frame.
  • finder_bottom_placeholder - for a container that will be placed below the finder frame.
<io.scanbot.sdk.ui.camera.ScanbotCameraXView
android:id="@+id/cameraView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

<io.scanbot.sdk.ui.camera.FinderOverlayView
android:id="@+id/my_finder_view"
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/finder_top_placeholder"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/finder_center_placeholder"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/finder_bottom_placeholder"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</io.scanbot.sdk.ui.camera.FinderOverlayView>

All 3 zones in finder, colored.

It is also possible to add views programmatically by calling:


finderOverlayView.addTopPlaceholder(view)
finderOverlayView.addBottomPlaceholder(view)
finderOverlayView.addFinderPlaceholder(view)

Main configuration

The Scanbot SDK provides the ability to modify the default configuration of ScanbotBarcodeDetector. Here is an example of how to specify a completely custom BarcodeScannerConfig:

val barcodeDetector = ScanbotBarcodeScannerSDK(context).createBarcodeDetector()
val config = BarcodeScannerConfig(
barcodeFormats = BarcodeFormat.COMMON_CODES,
acceptedDocumentFormats = emptyList(),
engineMode = EngineMode.NextGen,
saveCameraPreviewFrame = false,
additionalConfig = BarcodeScannerAdditionalConfig()
)
barcodeDetector.setConfig(config)

Alternatively, utilize method modifyConfig to edit only some of the parameters:

barcodeDetector.modifyConfig {
setBarcodeFormats(BarcodeFormat.COMMON_CODE)
setEngineMode(EngineMode.NextGen)
}

The parameters currently available in BarcodeScannerConfig are:

  • barcodeFormats: list of BarcodeFormats to scan. Default is BarcodeFormat.COMMON_CODES
  • acceptedDocumentFormats: list of BarcodeDocumentFormats to scan. Default is an empty list, meaning no filtering is done and all formats are accepted.
  • engineMode: defines used Barcode Scanner EngineMode. Default is EngineMode.NextGen
  • saveCameraPreviewFrame: whether the detector should save a frame with the successful detection result. If true - BarcodeScanningResult will contain the camera preview frame Bitmap, otherwise the preview frame will not be collected. Defaults to false.
  • additionalConfig: additional config for specific barcode types.

Additional configuration

Some peculiar use-cases require special handling. For example, we can configure ScanbotBarcodeDetector to scan only barcodes of expected lengths. This might reduce false scans. Such parameters work only for enumerated types of barcodes and, usually, you don't need to modify their default values.

Users can specify these parameters via BarcodeScannerAdditionalConfig entity as a part of BarcodeScannerConfig:

val barcodeDetector = ScanbotBarcodeScannerSDK(context).createBarcodeDetector()
val additionalConfig = BarcodeScannerAdditionalConfig(
minimumTextLength = 0,
maximumTextLength = 0,
minimum1DQuietZoneSize = 10,
gs1DecodingEnabled = true,
msiPlesseyChecksumAlgorithms = EnumSet.of(MSIPlesseyChecksumAlgorithm.Mod10),
lowPowerMode = false,
codeDensity = BarcodeDensity.LOW,
decodeStacks1D = BarcodeScannerAdditionalConfig.DEFAULT_DECODE_STACKS_1D
)
val config = BarcodeScannerConfig(
additionalConfig = additionalConfig,
// modify other parameters
)
barcodeDetector.setConfig(config)

Alternatively, utilize methods modifyConfig and modifyAdditionalConfig to edit only some of the parameters:

barcodeDetector.modifyConfig {
modifyAdditionalConfig {
setMinimumTextLength(0)
setMaximumTextLength(0)
setMinimum1DQuietZoneSize(10)
setGs1DecodingEnabled(true)
setMsiPlesseyChecksumAlgorithms(EnumSet.of(MSIPlesseyChecksumAlgorithm.Mod10))
lowPowerMode(false)
codeDensity(BarcodeDensity.LOW)
decodeStacks1D(BarcodeScannerAdditionalConfig.DEFAULT_DECODE_STACKS_1D)
}
// modify other parameters
}

The parameters currently available in BarcodeScannerAdditionalConfig are:

  • minimumTextLength: minimum required text length of the detected barcode. The default value is 0 (the setting is turned off). Currently works for ITF and MSI Plessey barcodes only!
  • maximumTextLength: maximum text length of the detected barcode. Setting to zero removes the limit. The default value is 0 (the setting is turned off). Currently works for ITF and MSI Plessey barcodes only!
  • minimum1DQuietZoneSize: minimum required quiet zone of the barcode. Measured in modules (the size of a minimal bar of the barcode). The default value is 10. Currently works for ITF and MSI Plessey barcodes only!
  • gs1DecodingEnabled: when set to true, the scanner assumes that the barcode can be a GS1 barcode. Turn it off if you don't want to see decoded FNC1 characters ("]C1" and ASCII char 29). The default is true. Currently works for CODE128 barcodes only!
  • msiPlesseyChecksumAlgorithms: the checksum algorithms for MSI Plessey barcodes. The default value is MSIPlesseyChecksumAlgorithm.Mod10.
  • lowPowerMode: when set to true, this mode slightly decreases the scanning quality and energy consumption, thereby increasing the scanning speed. The battery life and overall scanning performance is thus improved on low end devices. The default is false.
  • codeDensity: the expected density of QR codes. A higher density finds more QR codes in an image but the performance is slightly reduced. The default is BarcodeDensity.LOW.
  • decodeStacks1D: number of stacks to split a 1D barcode crop before extracting scanlines. For stacked RSS barcodes, this should be set to the numbers of stacks with which the barcode was printed. For other barcodes, the default of 1 is good enough. Setting it higher will improve the performance on difficult barcodes, but will slightly increase frame times and possibly increase the number of false positives.

Full Example of a Custom Activity

As a final step, you have to connect the ScanbotCameraXView with BarcodeDetectorFrameHandler and BarcodeAutoSnappingController. The ScanbotBarcodeDetector can be used to detect and parse barcodes from still images (Bitmap), e.g. JPG files from the photo library or other sources.

Please see an example implementation of a fully customizable Activity in our demo:

👉 QRScanCameraViewActivity.kt

Data parsers

Barcodes, especially the two-dimensional ones, e.g. data matrices and QR codes, are often used to encode structured data or documents. This structured data can be parsed into document-like data structures that let you access the data fields conveniently, for example Swiss QR-Codes, SEPA forms, medical plans, boarding passes, medical certificates and vCard addresses.

Barcodes, especially the two-dimensional ones, e.g. data matrices and QR codes, are often used to encode structured data or documents. This structured data can be parsed into document-like data structures that let you access the data fields conveniently, for example Swiss QR-Codes, SEPA forms, medical plans, boarding passes, medical certificates and vCard addresses.

The following data parsers are currently supported:

  • AAMVA: Parse the AAMVA data format from PDF-417 barcodes on US driver’s licenses.
  • Boarding pass data from PDF-417 barcodes.
  • Parser for German Medical Certificates (aka. Disability Certificate or AU-Bescheinigung) coded in a PDF-417 barcode.
  • GS1 encoded data from barcodes.
  • Data from PDF-417 barcodes on ID Cards.
  • Parse and extract data from XML of Data Matrix barcodes on Medical Plans (German Medikationsplan).
  • Data parser of QR-Code values printed on SEPA pay forms.
  • vCard data from a QR-Code (e.g. on business cards).
  • Swiss QR data from a QR-Code for easy, automatic and efficient payments.

Manual data parsing

For manual parsing of a decoded barcode string into formatted document data, use BarcodeDocumentParser.

val scanbotSDK = ScanbotBarcodeScannerSDK(context);
scanbotSDK.createBarcodeDocumentParser().parseDocument(barcodeString)

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?