IRONSOFTWAREHOME
USING IRONBARCODE

How to Build a .NET MAUI Barcode Scanner SDK App

Curtis Chau
Curtis Chau
Updated: August 1, 2026

.NET MAUI delivers on the promise of a single codebase that targets Android, iOS, and Windows. The challenge comes when you need to integrate native hardware features like barcode scanning. Bridging camera APIs manually means platform-specific configurations, conditional compile directives, and hours of debugging. There is a faster path.

This tutorial shows you how to build a working cross-platform barcode scanner in .NET MAUI using IronBarcode. You will set up the project, configure platform permissions, scan barcodes from image files, read barcodes from PDF documents, and handle multiple symbologies with scanning options -- all with code you can run on any supported target.

Start your free trial and follow the steps below.

NuGetInstall with NuGet

PM > Install-Package BarCode

Install IronBarcode by running the command above in the NuGet Package Manager Console, or search for the package in the NuGet Package Manager.

How Do You Set Up a Barcode Scanner SDK in .NET MAUI?

Setting up a .NET MAUI barcode scanner SDK requires creating a new project, installing the NuGet package, and configuring platform permissions. The entire configuration process takes a few minutes in Visual Studio.

Create the .NET MAUI Project

Open Visual Studio and create a new .NET MAUI App project. Name the project something descriptive like "BarcodeScanner" and select .NET 8 or later as the target framework. Visual Studio generates the default project structure with platform-specific folders for Android and iOS.

If you are targeting .NET 10, the same project template applies. Update the <TargetFrameworks> property in your .csproj file to include net10.0-android, net10.0-ios, and net10.0-windows10.0.19041.0 as required. Refer to the .NET MAUI supported platforms documentation for the full list of target framework monikers and minimum OS version requirements.

Install IronBarcode

Install the IronBarcode NuGet package using the Package Manager Console:

PM > Install-Package BarCode

This command downloads and installs the barcode scanner SDK along with all required dependencies for the .NET MAUI application.

Configure Platform Permissions

Even when scanning from image files rather than a live camera feed, it is good practice to configure the following permissions for the .NET MAUI barcode scanner app.

For Android, add the following to Platforms/Android/AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
XML

For iOS, add these entries to Platforms/iOS/Info.plist:

<key>NSPhotoLibraryUsageDescription</key>
<string>Access needed to select barcode images for scanning.</string>
<key>NSCameraUsageDescription</key>
<string>Camera permission for barcode scanning.</string>
XML

Initialize the SDK

Set your license key early in the application lifecycle to ensure IronBarcode is fully activated before any scanning calls are made. Place the activation in MauiProgram.cs:

using IronBarCode;

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

// Activate IronBarcode before the app starts
License.LicenseKey = "YOUR_LICENSE_KEY_HERE";

return builder.Build();

IronBarcode provides a free trial license for development and testing. Set the key once at startup; all subsequent calls to BarcodeReader and BarcodeWriter within the same process use the activated license.

How Do You Read Barcodes from Image Files?

The core functionality of any MAUI barcode scanner is reading barcodes from selected images. The BarcodeReader.Read() method accepts a file path and returns a collection of BarcodeResult objects, one per detected barcode.

Design the User Interface

Create a clean interface in MainPage.xaml that allows users to select an image file and view the scanned barcode data:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="BarcodeScanner.MainPage">
    <VerticalStackLayout Padding="20" Spacing="15">
        <Label Text=".NET MAUI Barcode Scanner" FontSize="24" HorizontalOptions="Center"/>
        <Button Text="Select Image to Scan" Clicked="OnSelectImageClicked"/>
        <Image x:Name="SelectedImageView" HeightRequest="200"/>
        <Label x:Name="ResultLabel" FontSize="16"/>
    </VerticalStackLayout>
</ContentPage>
XML

Implement Barcode Scanning

Add the scanning logic to MainPage.xaml.cs. This code handles image selection via the MAUI FilePicker API and passes the chosen file path to IronBarcode:

using IronBarCode;

public partial class MainPage : ContentPage
{
    public MainPage()
    {
        InitializeComponent();
    }

    private async void OnSelectImageClicked(object sender, EventArgs e)
    {
        var result = await FilePicker.PickAsync(new PickOptions
        {
            FileTypes = FilePickerFileType.Images,
            PickerTitle = "Select a barcode image"
        });

        if (result != null)
        {
            // Display the selected image
            SelectedImageView.Source = ImageSource.FromFile(result.FullPath);

            // Read barcodes from the image file
            var barcodes = BarcodeReader.Read(result.FullPath);

            ResultLabel.Text = barcodes.Any()
                ? $"Found: {barcodes.First().Value}"
                : "No barcodes detected in selected image.";
        }
    }
}

Output

.NET MAUI Barcode Scanner SDK: Build a Cross-Platform Scanner in Minutes: Image 1 - Scanned barcode output

The BarcodeReader.Read() method analyzes the selected image and returns all detected barcodes. IronBarcode automatically recognizes multiple barcode symbologies including QR codes, Code 128, Code 39, EAN-13, and many other supported formats. The result collection exposes properties like BarcodeType, Value, PageNumber, and bounding box coordinates for each detected code.

How Do You Scan Barcodes from PDF Documents?

One capability that distinguishes IronBarcode from many alternatives is reading barcodes directly from PDF files. This is essential for .NET MAUI apps that handle document workflows -- shipping manifests, purchase orders, medical records, and similar use cases all rely on PDF-embedded barcodes.

The BarcodeReader.ReadPdf() method accepts a file path and returns the same BarcodeResult collection as the image reader, with an additional PageNumber property that identifies which PDF page each barcode came from:

using IronBarCode;

private async void OnSelectPdfClicked(object sender, EventArgs e)
{
    var result = await FilePicker.PickAsync(new PickOptions
    {
        PickerTitle = "Select a PDF with barcodes"
    });

    if (result != null)
    {
        // Read barcodes from every page of the PDF
        var barcodes = BarcodeReader.ReadPdf(result.FullPath);

        var output = string.Join("\n", barcodes.Select(b =>
            $"Page {b.PageNumber}: [{b.BarcodeType}] {b.Value}"));

        await DisplayAlert("Scan Results", output.Length > 0 ? output : "No barcodes found.", "OK");
    }
}

Output

.NET MAUI Barcode Scanner SDK: Build a Cross-Platform Scanner in Minutes: Image 2 - Output for scanning a PDF with QR codes within it

The ReadPdf() method scans all pages of a PDF and returns barcode data along with page numbers, making it straightforward to process documents containing multiple barcodes. If the PDF spans dozens of pages, consider passing a BarcodeReaderOptions object with PageNumbers set to a specific range to limit the scan to relevant pages and reduce processing time.

How Do You Handle Multiple Barcodes and QR Codes?

Production apps often need to detect multiple barcodes from a single image or filter results by barcode type. The BarcodeReaderOptions class exposes the configuration properties that control detection behavior. Setting ExpectMultipleBarcodes to true tells the reader to continue scanning after the first match rather than stopping early:

using IronBarCode;

// Configure the reader for multi-barcode detection with type filtering
var options = new BarcodeReaderOptions
{
    ExpectMultipleBarcodes = true,
    ExpectBarcodeTypes = BarcodeEncoding.QRCode | BarcodeEncoding.Code128,
    Speed = ReadingSpeed.Balanced
};

var barcodes = BarcodeReader.Read(imagePath, options);

foreach (var barcode in barcodes)
{
    Console.WriteLine($"Type: {barcode.BarcodeType}, Value: {barcode.Value}");
}

The Speed property controls the trade-off between scan time and accuracy. ReadingSpeed.Faster prioritizes throughput, which suits apps scanning high-quality images in bulk. ReadingSpeed.ExtraSlow applies more aggressive image correction passes for challenging inputs -- low contrast, skewed angles, or partially occluded codes. ReadingSpeed.Balanced is the right starting point for most applications.

The BarcodeEncoding enumeration supports bitwise combinations, so you can restrict scanning to exactly the symbologies relevant to the use case without penalizing performance with unnecessary checks.

How Do You Read Barcodes from Memory Streams?

File paths work well in most scenarios, but some .NET MAUI workflows pass image data through memory -- captured frames from a camera preview, bytes downloaded from a REST API, or image data generated in-process. IronBarcode supports System.IO.Stream inputs directly on the BarcodeReader.Read() overload:

using IronBarCode;
using System.IO;

// Read a barcode from a MemoryStream (e.g., an in-memory image buffer)
private BarcodeResult[] ReadFromStream(Stream imageStream)
{
    return BarcodeReader.Read(imageStream);
}

// Example: download an image and scan without writing to disk
private async Task<string> ScanDownloadedBarcode(string imageUrl)
{
    using var httpClient = new HttpClient();
    using var stream = await httpClient.GetStreamAsync(imageUrl);
    using var memoryStream = new MemoryStream();

    await stream.CopyToAsync(memoryStream);
    memoryStream.Position = 0;

    var barcodes = BarcodeReader.Read(memoryStream);
    return barcodes.Any() ? barcodes.First().Value : string.Empty;
}

The stream overload accepts any Stream subclass, including MemoryStream, FileStream, and network streams. The library handles format detection internally, so you do not need to specify the image type before calling Read().

How Do You Generate Barcodes in a MAUI App?

IronBarcode handles barcode generation as well as reading. The BarcodeWriter class produces barcodes as image files, Bitmap objects, or Stream instances that you can display inline in a MAUI view. This is useful for inventory apps that need to print or share barcodes alongside scanning functionality:

using IronBarCode;

// Generate a QR code and display it in a MAUI Image control
private async void OnGenerateQrClicked(object sender, EventArgs e)
{
    // Create a QR code barcode
    var qrCode = QRCodeWriter.CreateQrCode(
        value: "https://ironsoftware.com/csharp/barcode/",
        qrCodeSize: 500,
        errorCorrection: QRCodeWriter.QrErrorCorrectionLevel.Medium
    );

    // Save to a temporary file and display
    var tempPath = Path.Combine(FileSystem.CacheDirectory, "generated-qr.png");
    qrCode.SaveAsPng(tempPath);

    GeneratedImageView.Source = ImageSource.FromFile(tempPath);
}

The QRCodeWriter class supports all four QR error correction levels (Low, Medium, Quartile, High), custom sizing, and styling options including foreground/background color control. For non-QR symbologies, use BarcodeWriter.CreateBarcode() with the appropriate BarcodeEncoding value. The barcode generation API reference documents all supported output formats.

What Are the Key Capabilities of This Barcode Scanner Library?

IronBarcode delivers several advantages for .NET MAUI barcode scanning projects that distinguish it from open-source alternatives like ZXing.Net.MAUI:

IronBarcode capabilities for .NET MAUI development
CapabilityDetail
Cross-platform supportTargets Android, iOS, and Windows from a single NuGet package
Multiple input sourcesScan from file paths, memory streams, and PDF documents
Format coverageDecodes 30+ 1D and 2D symbologies including QR, Data Matrix, and PDF417
Barcode generationProduces QR codes and 1D barcodes as PNG, bitmap, or stream output
Image correctionHandles rotated, skewed, and low-contrast inputs automatically
No native SDK dependencyPure .NET library with no platform-specific native bindings required

The "no native SDK dependency" point matters in .NET MAUI projects because platform-specific native libraries require separate linking steps for each target. IronBarcode avoids this complexity entirely, which means the same NuGet reference produces working binaries for all three supported platforms without additional configuration.

For a full list of supported barcode formats, see the IronBarcode supported formats documentation. For pricing and licensing terms for production deployment, review the IronBarcode licensing page.

What Are the Best Practices for Barcode Scanning in Production?

Deploying a barcode scanner to production requires attention to a few areas beyond the basic read call. The following guidelines address the most common failure points in .NET MAUI barcode apps.

Choose the right reading speed. ReadingSpeed.Balanced handles most real-world images correctly. Reserve ReadingSpeed.ExtraSlow for scans of printed documents or images that users cannot re-capture. Avoid ReadingSpeed.ExtraSlow for high-volume workflows since each scan takes considerably longer.

Filter by expected types. If the app only processes QR codes, set ExpectBarcodeTypes = BarcodeEncoding.QRCode. Restricting the search space reduces processing time and eliminates false positives from other symbologies present in background graphics.

Use ExpectMultipleBarcodes only when needed. Setting this to true always causes the reader to make additional passes. For single-barcode inputs, leave the default (false) so the scan returns as soon as the first valid code is found.

Handle empty results gracefully. BarcodeReader.Read() returns an empty array rather than throwing when no barcodes are detected. Check .Any() before accessing First() and present a clear message to the user. A retry prompt with guidance ("ensure the barcode is well-lit and centered") improves the user experience more than a generic error.

Cache the options object. Creating a BarcodeReaderOptions instance on every scan adds allocations. Construct the options once at the class level and reuse it across calls.

Refer to the IronBarcode troubleshooting guide and the barcode reader tutorial for additional guidance on diagnosing scan failures and optimizing performance.

What Are Your Next Steps?

Building a .NET MAUI barcode scanner with IronBarcode requires installing a single NuGet package, configuring platform permissions, and calling BarcodeReader.Read() with a file path or stream. The same API targets Android, iOS, and Windows without platform-specific code branches.

To extend the app further, consider the following resources:

Start your free trial to get a development license key, or explore licensing options for production deployment.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Related Articles

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required