GeniusScanSDK.ScanFlow.Android
4.18.0
See the version list below for details.
dotnet add package GeniusScanSDK.ScanFlow.Android --version 4.18.0
NuGet\Install-Package GeniusScanSDK.ScanFlow.Android -Version 4.18.0
<PackageReference Include="GeniusScanSDK.ScanFlow.Android" Version="4.18.0" />
paket add GeniusScanSDK.ScanFlow.Android --version 4.18.0
#r "nuget: GeniusScanSDK.ScanFlow.Android, 4.18.0"
// Install GeniusScanSDK.ScanFlow.Android as a Cake Addin #addin nuget:?package=GeniusScanSDK.ScanFlow.Android&version=4.18.0 // Install GeniusScanSDK.ScanFlow.Android as a Cake Tool #tool nuget:?package=GeniusScanSDK.ScanFlow.Android&version=4.18.0
Description
This Xamarin plugin allows you to access the Genius Scan SDK core features from a Xamarin.Android application:
- Automatic document detection
- Document perspective correction
- Image enhancement with 4 different modes (Black & white, Monochrome, Color, Photo)
- Batch scanning of several pages in row
- OCR to extract raw text from images and generate PDF with invisible text layer
Licence
This plugin is based on the Genius Scan SDK for which you need to setup a licence. You can aleady try the "demo" version for free by not setting a licence key, the only limitation being that the app will exit after 60 seconds.
To buy a license:
- Sign up to our developer console
- Submit a quote request for each application
You can learn more about licensing on our website and contact us at sdk@geniusscan.com for further questions.
Demo application
As an example, you can check our demo application
Usage
Set the licence key
Initialize the SDK with a valid licence key:
ScanFlow.Init(Xamarin.Essentials.Platform.CurrentActivity, licenseKey);
Init
will throw a LicenseException
if the license key is not valid anymore or if it does not match the application ID. Note that, for testing purpose, you can also use the plugin without a licence key, but it will only work for 60 seconds.
It is recommended to show a message to users asking them to update the application in case the license has expired.
Start the scanner module
The following line will start a scan flow with the corresponding configuration:
PluginBridge.ScanWithConfiguration(Xamarin.Essentials.Platform.CurrentActivity, configuration);
The method ScanWithConfiguration
takes a configuration
parameter which can take the following options:
source
:camera
,image
orlibrary
(defaults to camera)sourceImageUrl
: an absolute image url, required ifsource
isimage
. Example:file:///var/…/image.png
multiPage
: boolean (defaults to true). If true, after a page is scanned, a prompt to scan another page will be displayed. If false, a single page will be scanned.multiPageFormat
:pdf
,tiff
,none
(defaults topdf
)defaultFilter
:none
,blackAndWhite
,monochrome
,color
,photo
(by default, the filter is chosen automatically)pdfPageSize
:fit
,a4
,letter
, defaults to fit.pdfMaxScanDimension
: max dimension in pixels when images are scaled before PDF generation, for example 2000 to fit both height and width within 2000px. Defaults to 0, which means no scaling is performed.pdfFontFileUrl
: Custom font file used during the PDF generation to embed an invisible text layer. If null, a default font is used, which only supports Latin languages.jpegQuality
: JPEG quality used to compress captured images. Between 0 and 100, 100 being the best quality. Default is 60.postProcessingActions
: an array with the desired actions to display during the post processing screen (defaults to all actions). Possible actions arerotate
,editFilter
.flashButtonHidden
: boolean (default to false)defaultFlashMode
:auto
,on
,off
(default tooff
)foregroundColor
: string representing a color, must start with a#
. The color of the icons, text (defaults to '#ffffff').backgroundColor
: string representing a color, must start with a#
. The color of the toolbar, screen background (defaults to black)highlightColor
: string representing a color, must start with a#
. The color of the image overlays (default to blue)menuColor
: string representing a color, must start with a#
. The color of the menus (defaults to system defaults.)ocrConfiguration
: text recognition options. Text recognition will run on a background thread for every captured image. No text recognition will be applied if this parameter is not present.languages
: list of language codes (eg["eng"]
) for which to run text recognition. They should match the provided language files. Note that text recognition will take longer if multiple languages are specified.languagesDirectoryUrl
: folder containing the language files used for text recognition. Language files can be downloaded from https://github.com/tesseract-ocr/tessdata_fast.outputFormats
: an array with the formats in which the OCR result is made available in the ScanFlow result (defaults to all formats). Possible formats arerawText
,hOCR
andtextLayerInPDF
.
The result of the scan flow will be provided in the OnActivityResult
callback:
protected override void OnActivityResult(Int32 requestCode, Result resultCode, Intent data)
{
PromiseResult result = PluginBridge.GetPromiseResultFromActivityResult(this, requestCode, (int)resultCode, data);
// Do something with the result
}
The result
object contains:
multiPageDocumentUrl
: a document containing all the scanned pages (example: "file://<filepath>.pdf")scans
: an array of scan objects. Each scan object has:originalUrl
: the original file as scanned from the camera. "file://<filepath>.jpeg"enhancedUrl
: the cropped and enhanced file, as processed by the SDK. "file://<filepath>.{jpeg|png}"ocrResult
: the result of text recognition for this scantext
: the raw text that was recognizedhocrTextLayout
: the recognized text in hOCR format (with position, style…)
Proguard
Due to an issue in Xamarin, any Proguard files in AARs are not taken into account in Xamarin apps. This means any developer using the package has to manually add the -keep class com.geniusscansdk.** { *; }
line to their Xamarin proguard configuration until this Xamarin issue is fixed.
It's currently being tracked here: https://github.com/xamarin/xamarin-android/issues/3752
FAQ
How do I get the UI translated to another language?
The device's locale determines the languages used by the plugin for all strings: user guidance, menus, dialogs…
The plugin supports a wide variety of languages: English (default), Arabic, Chinese (Simplified), Chinese (Traditional), Danish, Dutch, French, German, Hebrew, Indonesian, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish, Turkish, Vietnamese.
What should I do if my license is invalid?
Make sure that the license key is correct, that is has not expired, and that it is used with the App ID it was generated for. To learn more about the procurement and replacement of license keys, refer to the Licensing FAQ.
Troubleshooting
Refer to the troubleshooting guides of the native Android libraries to resolve common configuration and build problems.
Changelog
See changelog
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0-android33.0 is compatible. net8.0-android was computed. |
-
net7.0-android33.0
- Xamarin.AndroidX.Activity (>= 1.8.0.1)
- Xamarin.AndroidX.Camera.Camera2 (>= 1.3.0)
- Xamarin.AndroidX.Camera.Lifecycle (>= 1.3.0)
- Xamarin.AndroidX.ConstraintLayout (>= 2.1.4.8)
- XamarinLibrary.Xamarin.Android.Parse.Bolts.BoltsTasks (>= 1.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
5.3.1 | 79 | 11/12/2024 |
5.3.0 | 342 | 10/4/2024 |
5.2.0 | 185 | 9/11/2024 |
5.1.5 | 139 | 8/5/2024 |
5.1.4 | 91 | 7/29/2024 |
5.1.3 | 109 | 7/26/2024 |
5.1.2 | 113 | 7/23/2024 |
5.1.1 | 153 | 7/11/2024 |
5.1.0 | 357 | 6/19/2024 |
5.0.8 | 288 | 6/5/2024 |
5.0.7 | 157 | 6/3/2024 |
5.0.6 | 216 | 5/24/2024 |
5.0.5 | 321 | 4/22/2024 |
5.0.4 | 159 | 4/18/2024 |
5.0.3 | 210 | 4/15/2024 |
5.0.2 | 240 | 4/9/2024 |
5.0.1 | 261 | 4/4/2024 |
5.0.0 | 195 | 4/3/2024 |
5.0.0-beta9 | 193 | 3/19/2024 |
5.0.0-beta8 | 260 | 3/5/2024 |
5.0.0-beta7 | 155 | 2/20/2024 |
5.0.0-beta6 | 179 | 2/15/2024 |
5.0.0-beta5 | 200 | 2/14/2024 |
5.0.0-beta4 | 145 | 2/9/2024 |
5.0.0-beta3 | 174 | 2/9/2024 |
5.0.0-beta2 | 186 | 2/7/2024 |
5.0.0-beta1 | 141 | 1/19/2024 |
4.21.1 | 223 | 2/14/2024 |
4.21.0 | 528 | 12/20/2023 |
4.20.1 | 328 | 12/12/2023 |
4.20.0 | 289 | 12/11/2023 |
4.19.0 | 295 | 11/27/2023 |
4.18.0 | 294 | 11/15/2023 |
4.17.0 | 248 | 11/15/2023 |
4.16.0 | 258 | 11/7/2023 |
4.15.0 | 527 | 11/2/2023 |
4.14.0 | 322 | 10/17/2023 |
4.13.0 | 379 | 9/1/2023 |
4.12.0 | 1,111 | 6/1/2023 |
4.11.0 | 1,253 | 5/24/2023 |
4.10.1 | 1,464 | 4/20/2023 |
4.10.0 | 451 | 4/13/2023 |
4.9.0 | 1,152 | 3/14/2023 |
4.8.0 | 1,936 | 1/24/2023 |
4.7.4 | 2,209 | 12/9/2022 |
4.7.3 | 1,267 | 11/17/2022 |
4.7.2 | 1,060 | 11/11/2022 |
4.7.1 | 978 | 11/9/2022 |
4.7.0 | 846 | 11/7/2022 |
4.6.0 | 1,159 | 10/4/2022 |
4.5.0 | 1,623 | 4/22/2022 |
4.4.7 | 1,335 | 3/26/2022 |
4.4.6 | 847 | 3/15/2022 |
4.4.5 | 814 | 3/1/2022 |
4.4.4 | 820 | 2/16/2022 |
4.4.3 | 896 | 1/16/2022 |
4.4.2 | 598 | 12/15/2021 |
4.4.1 | 1,041 | 12/8/2021 |
4.3.0 | 778 | 11/23/2021 |
4.2.2 | 879 | 11/12/2021 |
4.1.4 | 768 | 10/26/2021 |
4.1.3 | 561 | 9/28/2021 |
4.1.2 | 590 | 9/14/2021 |
4.1.1 | 643 | 9/10/2021 |
4.1.0 | 654 | 9/9/2021 |
4.0.12 | 586 | 8/26/2021 |
4.0.11 | 603 | 8/18/2021 |
4.0.10 | 658 | 7/2/2021 |
4.0.9 | 612 | 6/24/2021 |
4.0.8 | 622 | 5/7/2021 |
4.0.7 | 735 | 3/31/2021 |
4.0.6 | 561 | 3/29/2021 |
1.0.7 | 745 | 3/15/2021 |
1.0.5 | 766 | 2/9/2021 |