Skip to content

.NET MAUI (formerly Xamarin) Framework for reading and validation of identification documents

Notifications You must be signed in to change notification settings

regulaforensics/Xamarin-DocumentReader

Repository files navigation

Xamarin - Regula Document Reader

MAUI: copy regula.license to DocumentReaderSample/Resources/Raw/regula.license copy db.dat to DocumentReaderSample/Platforms/Android/Assets/Regula/db.dat and to DocumentReaderSample/Resources/Raw/db.dat

Regula Document Reader SDK allows you to read various kinds of identification documents, passports, driving licenses, ID cards, etc. All processing is performed completely offline on your device. No any data leaving your device.

You can use native camera to scan the documents or image from gallery for extract all data from it.

We have provided a simple application that demonstrates the API calls you can use to interact with the DocumentReader Library.

How to build demo application

  1. Visit client.regulaforensics.com to get a trial license (regula.license file). The license creation wizard will guide you through the necessary steps.
  2. Clone current repository using command git clone https://github.com/regulaforensics/Xamarin-DocumentReader.git.
  3. Download and install latest Visual Studio depend on your OS.
  4. Copy file regula.license to DocumentReaderSample/Droid/Assets or DocumentReaderSample/iOS/Resources folder.
  5. Copy file db.dat to DocumentReaderSample/Droid/Assets/Regula or DocumentReaderSample/iOS/Resources folder.
  6. Launch Visual Studio and select File -> Open then select DocumentReaderSample/DocumentReaderSample.sln file in file browser.
  7. Download additional files proposed by Visual Studio to build project (build tools, for example).
  8. Select appropriate build variant and run application.

Troubleshooting license issues

If you have issues with license verification when running the application, please verify that next is true:

  1. OS you are using is the same as in the license you received (Android).
  2. Date and time on the device you are trying to run the application is correct and inside the license validity period.
  3. You are using the latest release of the SDK.
  4. You placed the license into the correct folder as described here How to build demo application (DocumentReaderSample/Droid/Assets or DocumentReaderSample/iOS/Resources folder).
  5. You placed the db.dat into the correct folder as described here How to build demo application (DocumentReaderSample/Droid/Assets/Regula or DocumentReaderSample/iOS/Resources folder).

All available NuGet packages

You can find all available packages for Xamarin here.

Getting Started - Android

How to add DocumentReader library to your project

To install the libraries for Android, simply open your project and install our NuGet packages named Xamarin.DocumentReader.Api.Android and (Xamarin.DocumentReader.Core.Full.Android or Xamarin.DocumentReader.Core.FullRfid.Android). For more details on how to install a NuGet package, see here.

Once the libraries are installed, see our Document Reader Sample App for an example of how to use it.

Getting Started - iOS

How to add DocumentReader library to your project

To install the libraries for iOS, simply open your project and install our NuGet packages named Xamarin.DocumentReader.Api.iOS and Xamarin.DocumentReader.Core.Full.iOS . For more details on how to install a NuGet package, see here.

Initialization Core

After you added libraries from NuGet to the project, make sure that you initialized Core int the code. For example, take a look int the code below.

public partial class ViewController : UIViewController
{
   ....
   
   protected ViewController(IntPtr handle) : base(handle) =>
        //WARNING!!!!
        //Initialization DocumentReader from DocReaderCore is required
        new DocReaderCore.iOS.DocumentReader();
   
   ....
}

FYI: Xamarin is not included into ipa frameworks which are not called in the code. You can successfylly build project and run, but in runtime you will get error that DocumentReaderCore library not loaded. See error below.

dyld: Library not loaded: @rpath/DocumentReaderCore.framework/DocumentReaderCore

Update Info.plist into your project

Don't forgot update your plist with next properties:

  • Privacy - Camera Usage Description
  • Privacy - Photo Library Usage Description

It's required for make a snapshot from camera or get a photo from gallery.

Upload ipa to iTunes with SDK

Because we're using Swift language for API SDK, cannot upload ipa to iTunes without next steps.

  1. Archive your app for Publishing.
  2. When the Archives window pops up, go to it in Finder (right click on it and select “Reveal in Finder”).
  3. When Finder appears, we need to access the archive’s content (right click and select “Show Package Contents”).
  4. Inside of the archive package, create a folder called “SwiftSupport”.
  5. Inside of the package navigate to “Product/Applications/YourAppName.app/Frameworks” (You will need to right click on the .app and select “Show Package Contents”).
  6. Now you should replace all “.dylib” files with files from this folder: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos. Make sure you're not replaced all the swift “.dylib” files into Frameworks directory, because iTunes would reject build.
  7. After that copy all the swift “.dylib” files inside of the Frameworks updated directory.
  8. Navigate back to “SwiftSupport” and paste those copied libraries.
  9. Now Launch Xcode and load Organizer (Window -> Organizer).
  10. Find your app in the Archives and “Upload to App Store...“.

Once the libraries are installed, see our Document Reader Sample App for an example of how to use it.

About

.NET MAUI (formerly Xamarin) Framework for reading and validation of identification documents

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages