Skip to main content

SDK Features | .NET Document Scanner

Integration with ScanbotSDK.NET

The NuGet package ScanbotSDK.NET is a universal package for Android and iOS. It contains the MAUI Bindings for the Native Scanbot SDKs for Android and iOS and the Wrappers.


The bindings for Native SDKs and the Wrappers are stored in different namespaces which are explained here.

ScanbotSDK.NET Wrapper

  • Namespace for Android: ScanbotSDK.MAUI.Native.Droid
  • Namespace for iOS: ScanbotSDK.MAUI.Native.iOS

The idea of the ScanbotSDK.NET Wrapper is to provide a unified and convenient API for iOS and Android. However, since not all Native SDK functionalities are available in the Wrapper namespace, you can use and call them as needed directly from the native namespaces.

Currently the following Document Scanner SDK functionalities are available for the .NET Wrapper classes:

  • Document detection on images
  • Image processing (cropping and perspective correction, rotating, etc)
  • Image filters
  • PDF creation
  • TIFF creation
  • Text Recognition (OCR)

Native SDKs

Native SDKs for Android and iOS are provided as MAUI Bindings Libraries and can be found in these namespaces:

  • Android: Net.Doo.Snap, IO.Scanbot.Sdk
  • iOS: ScanbotSDK.iOS

The MAUI Bindings for the Native SDKs provide the most available functionality of the Scanbot SDK.

👉 Documentation for Native SDKs classes can be found here:

Scanbot SDK RTU UI Components

The Ready-To-Use UI (RTU UI) is a set of easy to integrate and customize high-level UI components (View Controllers for iOS and Activities for Android) for the most common tasks in Scanbot SDK. The design and behavior of these RTU UI Components are based on our many years of experience as well as the feedback from our SDK customers.

The following RTU UI Components and classes are currently provided:

  • Document Scanner - DocumentScannerActivity & DocumentScannerActivity
  • Cropping - CroppingActivity
  • MRZ Scanner - MRZScannerActivity
  • Barcode and QR-Code Scanner - BarcodeScannerActivity & BatchBarcodeScannerActivity
  • Generic Document Recognizer - GenericDocumentRecognizerActivity
  • European Health Insurance Card Scanner - HealthInsuranceCardScannerActivity
  • Check Recognizer - CheckRecognizerActivity
  • Text Data Scanner - TextDataScannerActivity
  • VIN Scanner - VinScannerActivity
  • License Plate Scanner - LicensePlateScannerActivity

For more details please see the corresponding API docs of the classes as well as our example app.

Customization of RTU UI:

The main idea of the RTU UI is to provide simple-to-integrate and simple-to-customize screen components. Due to this idea there are some limitations with the possibilities of customization:

  • UI: All colors and text resources (localization)
  • Behavior: Enable or disable features like Multi-Page Scanning, Auto Snapping, Flashlight

RTU UI Examples:

Please see our example app scanbot-sdk-maui-example on GitHub.

SDK Feature Overview

Barcode Scanner

The Scanbot SDK comes with an essential camera view, additional views for extending the camera functionality and a detector classes that handle all the camera and detection implementation details for you.

It provides a UI for document scanning guidance as well as a UI and functionality for manual and automatic shutter release on barcode detection.

Scanning Single Barcodes

Launches the barcode scanner. The scanned code will be returned asynchronously.


You then have to override OnActivityResult to process the result using the request code specified when launching the activity.

The result can be handled by:


Batch Barcode Scanning

Launches the batch barcode scanner. The scanned codes will be returned asynchronously.


You then have to override OnActivityResult to process the result using the request code specified when launching the activity.

The result can be handled by:


Detection on the Image

The Scanbot SDK detects barcodes from an existing image (UIImage or Bitmap). Result format is equivalent to Barcode Scanner


Document Scanner

The Scanbot SDK uses digital image processing algorithms to find rectangular, document like polygons in a digital image. As input a UIImage on iOS or Bitmap on Android are accepted.


Image Filtering

Page page = ...;
pageProcessor.ApplyFilter(page, ImageFilter.Binarized);

Supported image filters:

  • ImageFilter.ColorEnhanced - Optimizes colors, contrast and brightness.
  • ImageFilter.Grayscale - Grayscale filter
  • ImageFilter.Binarized - Standard binarization filter with contrast optimization. Creates an 8-bit grayscale image with mostly black or white pixels.
  • ImageFilter.ColorDocument - MagicColor filter. Fixes white balance and cleans up the background.
  • ImageFilter.PureBinarized - A filter for binarizing an image. Creates an image with pixel values set to either pure black or pure white.
  • ImageFilter.BackgroundClean - Cleans up the background and tries to preserve photos within the image.
  • ImageFilter.BlackAndWhite - Black and white filter with background cleaning. Creates an 8-bit grayscale image with mostly black or white pixels.
  • ImageFilter.OtsuBinarization - A filter for black and white conversion using OTSU binarization.
  • ImageFilter.DeepBinarization - A filter for black and white conversion primary used for low contrast documents.
  • ImageFilter.EdgeHighlight - A filter that enhances edges in low contrast documents.
  • ImageFilter.LowLightBinarization - A binarization filter primarily intended for use on low contrast documents with hard shadows.

Creating PDF Documents

The Scanbot SDK renders images into a PDF document and stores it as a given target file. For each image a separate page is generated.


The following PDF page sizes are supported:

Supported PDF Page Sizes

  • Letter: The page has US letter size: 8.5x11 inches. The image is fitted and centered within the page.
  • Legal: The page has US legal size: 8.5x14 inches. The image is fitted and centered within the page.
  • A3: The page has A3 size: 297x420 mm. The image is fitted and centered within the page.
  • A4: The page has the aspect ratio of the image, but is fitted into A4 size. Whether portrait or landscape depends on the images aspect ratio.
  • A5: The page has A5 size: 148x210 mm. The image is fitted and centered within the page.
  • B4: The page has B4 size: 250x353 mm. The image is fitted and centered within the page.
  • B5: The page has B5 size: 176x250 mm. The image is fitted and centered within the page.
  • Executive: The page has US executive size: 7.25x10.5 inches. The image is fitted and centered within the page.
  • US4x6: The page has US 4x6 size: 4x6 inches. The image is fitted and centered within the page.
  • US4x8: The page has US 4x8 size: 4x8 inches. The image is fitted and centered within the page.
  • US5x7: The page has US 5x7 size: 4x6 inches. The image is fitted and centered within the page.
  • Comm10: The page has COMM10 size: 4.125x9.5 inches. The image is fitted and centered within the page.
  • Custom: Each page is as large as its image at 72 dpi.

MRZ Scanner


EHIC Scanner

The Scanbot SDK detects and extracts data from European Health Insurance Cards.


Check Scanner

You can use the Check Recognizer UI to conveniently scan and extract data from checks.


Optical Character Recognition

The Scanbot SDK provides simple and convenient APIs to run Optical Character Recognition (OCR) on images.

As result you can get:

  • a searchable PDF document with the recognized text layer (aka. sandwiched PDF document)
  • recognized text as plain text
  • bounding boxes of all recognized paragraphs, lines and words
  • text results and confidence values for each bounding box

The Scanbot OCR feature comes with two OCR engines: Legacy and ML. The Legacy engine is based on the Tesseract OCR engine with some modifications and enhancements. The ML (machine learning based) engine was added later. It is much faster and more accurate, but it only supports languages with latin letters. Our recommendation is to use the ML engine whenever possible and use the legacy engine only if you want to recognize text from non-latin languages like Arabian, Japanese, Chinese, Russian, Greek, Korean etc.

When using the Legacy OCR engine for each desired OCR language, a corresponding OCR training data file (.traineddata) must be provided. Furthermore, the special data file osd.traineddata is required (used for orientation and script detection). The Scanbot SDK package contains no language data files to keep the SDK small in size. You have to download and include the desired language files in your app.

The newer ML engine does not require any language training data!

Preconditions to achieve a good OCR result

Conditions while scanning

A perfect document for OCR is flat, straight, in the highest possible resolution and does not contain large shadows, folds, or any other objects that could distract the recognizer. Our UI and algorithms do their best to help you meet these requirements. But as in photography, you can never fully get the image information back that was lost during the shot.


You can use multiple languages for OCR. But since the recognition of characters and words is a very complicated process, increasing the number of languages lowers the overall precision. With more languages, there are more results where the detected word could match. We suggest using as few languages as possible. Make sure that the language you are trying to detect is supported by the SDK and added to the project.

Size and position

Put the document on a flat surface. Take the photo from straight above in parallel to the document to make sure that the perspective correction does not need to be applied much. The document should fill most of the camera frame while still showing all of the text that needs to be recognized. This results in more pixels for each character that needs to be detected and hence, more detail. Skewed pages decrease the recognition quality.

Light and shadows

More ambient light is always better. The camera takes the shot at a lower ISO value, which results in less grainy photos. You should make sure that there are no visible shadows. If you have large shadows, it is better to take the shot at an angle instead. We also do not recommend using the flashlight - from this low distance it creates a light spot at the center of the document which decreases the recognition quality.


The document needs to be properly focused so that the characters are sharp and clear. The autofocus of the camera works well if you meet the minimum required distance for the lens to be able to focus. This usually starts at 5-10cm.


The OCR trained data is optimized for common serif and sans-serif font types. Decorative or script fonts drastically decrease the quality of recognition.

Download and Provide OCR Language Files

You can find a list of all supported OCR languages and download links on this Tesseract page.

⚠️️️ Please choose and download the proper version of the language data files:

Download the desired language files as well as the osd.traineddata file and place them in the Assets sub-folder SBSDKLanguageData/ of your Android app or in the Resources sub-folder ScanbotSDKOCRData.bundle/ of your iOS app.

Assets/SBSDKLanguageData/eng.traineddata  // english language file
Assets/SBSDKLanguageData/deu.traineddata // german language file
Assets/SBSDKLanguageData/osd.traineddata // required special data file



Detect Document Quality


Document Quality result:

  • VeryPoor - The quality of the document is very poor.
  • Poor - The quality of the document is poor.
  • Reasonable - The quality of the document is reasonable.
  • Good - The quality of the document is good.
  • Excellent - The quality of the document is excellent.

However, this is not as easy as it seems. If a scanned document has a predominantly white background, it will be considered a very poor image. It is therefore best to check the document quality on a pre-cropped document.

DocumentDetectionStatus enum:

  • Ok - Document detection was successful. The detected contour looks like a valid document.
  • OkButTooSmall - Document was detected, but it does not fill the desired area in the camera viewport. The quality can be improved by moving the camera closer to the document.
  • OkButBadAngles - Document was detected, but the perspective is wrong (camera is tilted relative to the document). Quality can be improved by holding the camera directly over the document.
  • OkButBadAspectRatio - Document was detected, but it has a wrong rotation relative to the camera sensor. Quality can be improved by rotating the camera 90 degrees.
  • ErrorTooDark - Document was not found, most likely because of bad lighting conditions.
  • ErrorTooNoisy - Document was not found, most likely because there is too much background noise (maybe too many other objects on the table, or the background texture is not monotonic).
  • ErrorNothingDetected - Document was not found. It is probably not in the viewport. Usually, it does not make sense to show any information to the user at this point.

Storage and Encryption

Scanbot SDK provides the ability to store the generated image files (JPG, PNG) and PDF files encrypted. This feature provides an additional level of security to the default secure storage locations of the native SDKs.

By default the file encryption is disabled. If you use ScanbotSDK wrapper, you have to pass the following config parameters on SDK initialization:

var initializer = new IO.Scanbot.Sdk.ScanbotSDKInitializer();
var processor = new AESEncryptedFileIOProcessor(
initializer.UseFileEncryption(true, processor);

By activating the storage encryption the native Scanbot SDKs will use the built-in AES 128 or AES 256 encryption. All generated image files (JPG, PNG) including the preview image files, as well as the exported PDF files will be encrypted in memory and stored as encrypted data files on the flash storage of the device.

The Scanbot SDK derives the AES key from the given password, an internal salt value, and the internal number of iterations using the PBKDF2 function.

When applying image operations like cropping, rotation or image filters, Scanbot SDK will decrypt the image file in memory, apply the changes, encrypt and store it again.

VIN Scanner

You can use the VIN Scanner UI to conveniently scan and extract the vehicle identification numbers.


Text Data Scanner

The Text Data Scanner recognizes text (OCR) within a user-defined rectangular area of interest, in consecutive video frames. A customizable block lets you clean up the raw string by filtering it against unwanted characters and OCR noise. Additionally, you can validate the result using pattern-matching or another block.


License Plate Scanner

The Scanbot SDK provides the ability to scan car license plates and parse data fields. Scanning is currently limited to common EU license plates (country code on blue background on the left side).


What do you think of this documentation?