Docutain.SDK.MAUI
3.0.0
dotnet add package Docutain.SDK.MAUI --version 3.0.0
NuGet\Install-Package Docutain.SDK.MAUI -Version 3.0.0
<PackageReference Include="Docutain.SDK.MAUI" Version="3.0.0" />
<PackageVersion Include="Docutain.SDK.MAUI" Version="3.0.0" />
<PackageReference Include="Docutain.SDK.MAUI" />
paket add Docutain.SDK.MAUI --version 3.0.0
#r "nuget: Docutain.SDK.MAUI, 3.0.0"
#:package Docutain.SDK.MAUI@3.0.0
#addin nuget:?package=Docutain.SDK.MAUI&version=3.0.0
#tool nuget:?package=Docutain.SDK.MAUI&version=3.0.0
Docutain SDK for .NET MAUI
Add document scanning, OCR text recognition, data extraction and PDF creation to your .NET MAUI app — for Android and iOS, from one shared codebase.
Everything runs on the device. No cloud, no server round trip, no data leaving the phone, and it works without a network connection.
What you get
- Document Scanner — ready-to-use UI with automatic edge detection, perspective correction, image filters, multi-page support and a page editing screen. Fully themeable: colors, texts, buttons, icons, onboarding and scan tips.
- OCR — text recognition of the scanned pages or of an imported PDF.
- Data Extraction — read address, IBAN, BIC, amount, date, invoice number and more as JSON.
- Photo Payment — turn a photo of an invoice into payment data, including GiroCode.
- PDF Creation — searchable PDFs with selectable text, page format and maximum file size, plus JPG export of single pages.
Individually licensable, so you only pay for the modules you use.
Requirements
| .NET | 9 or 10 |
| Android | 6.0 (API 23) or higher |
| iOS | 13.0 or higher |
Getting started
1. Initialize
Call this once on app start, before anything else of the SDK.
public partial class App : Application
{
public App()
{
InitializeComponent();
if (!DocutainSDK.InitSDK("<YOUR-LICENSE-KEY>"))
{
// Initialization failed - DocutainSDK.LastError says why.
// Do not call any other SDK method in this case.
var error = DocutainSDK.LastError;
}
}
}
You can pass an empty license key for a first look, but the SDK then stops working after one minute. Get a free extended trial key at sdk.docutain.com/TrialLicense.
On iOS, add a camera usage description to your Info.plist, otherwise the app is terminated when the
scanner opens:
<key>NSCameraUsageDescription</key>
<string>In order to scan documents, you need to grant permission to access the camera.</string>
2. Scan a document
var scanConfig = new DocumentScannerConfiguration();
bool scanned = await UI.ScanDocument(scanConfig);
DocumentScannerConfiguration is where you adapt the scan process and the look of the UI — see
Change default scan behaviour.
3. Create a PDF
The generated PDF contains the recognized text, so it is searchable and the text is selectable.
var pdf = await Document.WritePDFAsync(Path.Combine(FileSystem.CacheDirectory, "Scan.pdf"));
4. Read text and data
var text = await DocumentDataReader.GetTextAsync(); // OCR of all pages
var json = await DocumentDataReader.AnalyzeAsync(); // extracted fields as JSON
5. Export images
for (int page = 1; page <= Document.PageCount; page++)
await Document.WriteImageAsync(page, Path.Combine(folder, $"Page_{page}.jpg"));
Photo Payment
var paymentConfig = new PhotoPaymentConfiguration();
string? result = await UI.StartPhotoPayment(paymentConfig);
if (result == null)
{
// the user canceled
}
else if (result.Length == 0)
{
// nothing was detected - only reachable if you disabled the empty result screen
}
else
{
// result is a JSON string with the payment data, ready for your payment sheet
}
If your app was opened from another app via "open with" or "share", hand the received files over instead of opening the camera:
paymentConfig.ExternalFilePaths = new List<string> { receivedFilePath };
Sync and async
Every operation that touches files or runs recognition comes in both flavours. The …Async variant
does the work on a background thread, which keeps the UI responsive — recommended for anything but
the smallest documents.
| Synchronous | Asynchronous |
|---|---|
Document.LoadFile |
Document.LoadFileAsync |
Document.WritePDF |
Document.WritePDFAsync |
Document.WriteImage |
Document.WriteImageAsync |
Document.GetImageBytes |
Document.GetImageBytesAsync |
DocumentDataReader.LoadFile |
DocumentDataReader.LoadFileAsync |
DocumentDataReader.GetText |
DocumentDataReader.GetTextAsync |
DocumentDataReader.Analyze |
DocumentDataReader.AnalyzeAsync |
DocumentDataReader.SetAnalyzeConfiguration |
DocumentDataReader.SetAnalyzeConfigurationAsync |
DocutainSDK.DeleteTempFiles |
DocutainSDK.DeleteTempFilesAsync |
Error handling
Methods that can fail in an expected way return null or false, and
DocutainSDK.LastError tells you why. Everything the SDK itself gets wrong is an exception:
| Exception | Means |
|---|---|
DocutainSdkNotInitializedException |
InitSDK was not called or did not succeed |
DocutainSdkConfigurationException |
a configuration member was rejected; Member names it |
DocutainSdkFileAccessException |
the file could not be loaded, e.g. a wrong PDF password |
DocutainSdkNoHostException |
the app currently has no screen to present the scanner on |
Upgrading from 2.x
Version 3.0.0 requires .NET 9 or 10 and is binary breaking, so rebuild your app rather than swapping the assembly. The migration guide lists every change.
Documentation and sample app
- Documentation
- Sample app on GitHub
- Changelog
- Showcase apps — try the functionality without writing code
License and support
The Docutain SDK is a commercial product and requires a paid license for production use. Get a free trial key at sdk.docutain.com/TrialLicense.
Technical questions: support.sdk@Docutain.com
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0-android35.0 is compatible. net9.0-ios18.0 is compatible. net10.0-android was computed. net10.0-android36.0 is compatible. net10.0-ios was computed. net10.0-ios26.0 is compatible. |
-
net10.0-android36.0
- Karamunting.AndroidX.DaveMorrissey.SubsamplingScaleImageView (>= 3.10.0)
- Xamarin.AndroidX.Camera.Camera2 (>= 1.6.1)
- Xamarin.AndroidX.Camera.Core (>= 1.6.1)
- Xamarin.AndroidX.Camera.Lifecycle (>= 1.6.1)
- Xamarin.AndroidX.Camera.View (>= 1.6.1)
- Xamarin.AndroidX.Collection.Ktx (>= 1.6.0)
- Xamarin.AndroidX.ConstraintLayout (>= 2.2.1.1)
- Xamarin.AndroidX.DataBinding.ViewBinding (>= 7.3.0)
- Xamarin.AndroidX.ExifInterface (>= 1.4.2.2)
- Xamarin.AndroidX.Fragment.Ktx (>= 1.8.9.1)
- Xamarin.AndroidX.Preference.Preference.Ktx (>= 1.1.1.5)
- Xamarin.AndroidX.ViewPager2 (>= 1.1.0.6)
- Xamarin.Google.Android.Material (>= 1.12.0.3)
- Xamarin.Google.MLKit.TextRecognition (>= 116.0.1.1)
-
net10.0-ios26.0
- No dependencies.
-
net9.0-android35.0
- Karamunting.AndroidX.DaveMorrissey.SubsamplingScaleImageView (>= 3.10.0)
- Xamarin.AndroidX.Camera.Camera2 (>= 1.6.1)
- Xamarin.AndroidX.Camera.Core (>= 1.6.1)
- Xamarin.AndroidX.Camera.Lifecycle (>= 1.6.1)
- Xamarin.AndroidX.Camera.View (>= 1.6.1)
- Xamarin.AndroidX.Collection.Ktx (>= 1.6.0)
- Xamarin.AndroidX.ConstraintLayout (>= 2.2.1.1)
- Xamarin.AndroidX.DataBinding.ViewBinding (>= 7.3.0)
- Xamarin.AndroidX.ExifInterface (>= 1.4.2.2)
- Xamarin.AndroidX.Fragment.Ktx (>= 1.8.9.1)
- Xamarin.AndroidX.Preference.Preference.Ktx (>= 1.1.1.5)
- Xamarin.AndroidX.ViewPager2 (>= 1.1.0.6)
- Xamarin.Google.Android.Material (>= 1.12.0.3)
- Xamarin.Google.MLKit.TextRecognition (>= 116.0.1.1)
-
net9.0-ios18.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.