Skip to main content

Quick start for the .NET MAUI Document Scanner SDK

In this section, you'll learn how to set up the Scanbot Document Scanner SDK for .NET MAUI in your app, with Document Scanning enabled, all within 10 minutes — thanks to our Ready-to-Use UI!

Install the Document Scanner SDK

The Scanbot SDK for MAUI is available as the NuGet package ScanbotSDK.MAUI.

Add the NuGet package to your *.csproj file in your project folder:

<ItemGroup>
<PackageReference Include="ScanbotSDK.MAUI" Version="8.0.0" />
</ItemGroup>

Now, in your project folder, execute the dotnet restore command from the terminal to install the newly added NuGet package in your project.

Permissions

The Scanbot SDK needs access to the device camera so it can scan from a live camera stream. Therefore, you need to define the camera permission.

Make sure to add the Camera permission in your AndroidManifest.xml file:

<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />

The uses-feature tag also improves recognition of your app on the Google Play Store (see more).

Initializing the SDK

In MauiProgram.cs, initialize the Scanbot SDK by replacing the contents with the following code:

using ScanbotSDK.MAUI;
using ScanbotSDK.MAUI.Core.Sdk;

// Replace MauiDocScannerQuickStart with the namespace of your app.
namespace MauiDocScannerQuickStart;

public static class MauiProgram
{
// Without a license key, the Scanbot SDK will work for 1 minute.
// To scan longer, register for a trial license key here: https://scanbot.io/trial/
public const string LicenseKey = "";

public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});

#if DEBUG
builder.Logging.AddDebug();
#endif

ScanbotSDKMain.Initialize(builder, new SdkConfiguration
{
LicenseKey = LicenseKey,
LoggingEnabled = true,
});

return builder.Build();
}
}

Start the Document Scanner and process the result

With just a few lines of code, the Scanbot Document Scanner Ready-to-Use UI Component can be integrated into your application's workflow.

Start the scanner
loading...

🚀 That's it! 🚀 You have successfully integrated a full-featured document scanner as an RTU UI Screen into your app.

💡 Customization: In this Quick Start guide, we use the default configuration for the scanner UI. Feel free to explore the configs and customize the UI and behavior according to your needs via the DocumentScanningFlow class. For more details, refer to the Ready-to-Use UI section.

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get free trial license