IRONSOFTWAREHOME

How to Perform OCR on iOS in .NET MAUI

Curtis Chau
Curtis Chau
Updated: August 2, 2026
iOS

.NET MAUI (Multi-platform App UI) is an evolution of the Xamarin.Forms framework, designed to create cross-platform apps for Android, iOS, macOS, and Windows using .NET. MAUI aims to simplify the process of building native user interfaces that can run on multiple platforms.

The IronOcr.iOS package brings OCR support to iOS!

IronOCR iOS Package

The IronOcr.iOS package enables OCR features on iOS devices via .NET cross-platform projects. The vanilla IronOCR package is not needed.

PM > Install-Package IronOcr.iOS

C# NuGet Library for PDF

Install with NuGet

Install-Package IronOcr.iOS

Create a .NET MAUI Project

Under the Multiplatform section, select .NET MAUI App and continue.

Create .NET MAUI App project

Include the IronOCR.iOS Library

The library can be added in various ways. The easiest is perhaps by using NuGet.

  1. Inside Visual Studio, right-click on "Dependencies > Nuget" and select "Manage NuGet Packages ...".
  2. Select the "Browse" tab and search for "IronOcr.iOS".
  3. Select the "IronOcr.iOS" package and click on "Add Package".

Download IronOcr.iOS package

To prevent issues with other platforms, modify the csproj file to only include the package when targeting the iOS platform. In order to do so:

  1. Right-click on the *.csproj file for your project and select "Edit Project File".

  2. Create a new ItemGroup element as such:

    <ItemGroup Condition="$(TargetFramework.Contains('ios')) == true">
        <PackageReference Include="IronOcr.iOS" Version="YOUR_PACKAGE_VERSION" />
    </ItemGroup>
    XML
  3. Move the "IronOcr.iOS" PackageReference inside the ItemGroup we just created.

The above steps will prevent the "IronOcr.iOS" package from being used on, e.g., Android platforms (for that purpose, install IronOcr.Android instead).

Edit "MainPage.xaml"

Edit the XAML file to display a button and a label to show the OCR result. For example:

<?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="MAUIIronOCRiOSSample.MainPage">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Button
            Text="Import File"
            Clicked="ReadFileOnImport"
            Grid.Row="0"
            HorizontalOptions="Center"
            Margin="20, 20, 20, 10"/>

        <ScrollView
            Grid.Row="1"
            BackgroundColor="LightGray"
            Padding="10"
            Margin="10, 10, 10, 30">
            <Label x:Name="OutputText"/>
        </ScrollView>
    </Grid>

</ContentPage>
XML

Edit "MainPage.xaml.cs"

Start by instantiating the IronTesseract object. Make sure to initialize IronTesseract once in a class, as shown in the code below. Instantiating it directly in a method is not effective and could lead to unexpected errors. Then, use the FilePicker.PickAsync method to select a file. From the FileResult, open a stream for reading. Create a new OcrInput object and use this object to load the image. Use the Tesseract instance to perform OCR on the image and return the text. Finally, display the resulting text in a label.

The current implementation is limited to image files only. The package does not work with PDF documents yet. With this in mind, any configuration related to PDF documents should remain deactivated.

using System;
using IronOcr;
using Microsoft.Maui.Controls;

namespace MAUIIronOCRiOSSample;

public partial class MainPage : ContentPage
{
    // Initialize IronTesseract once in a class
    private IronTesseract ocrTesseract = new IronTesseract();

    public MainPage()
    {
        InitializeComponent();
        // Apply license key
        IronOcr.License.LicenseKey = "IRONOCR-MYLICENSE-KEY-1EF01";
    }

    private async void ReadFileOnImport(object sender, EventArgs e)
    {
        try
        {
            var options = new PickOptions
            {
                PickerTitle = "Please select a file"
            };

            var result = await FilePicker.PickAsync(options);
            if (result != null)
            {
                using var stream = await result.OpenReadAsync();

                // Instantiate OcrInput
                using var ocrInput = new OcrInput();

                // Load image stream
                ocrInput.LoadImage(stream);

                // Perform OCR
                var ocrResult = ocrTesseract.Read(ocrInput);
                OutputText.Text = ocrResult.Text;
            }
        }
        catch (Exception ex)
        {
            // Handle exceptions
            System.Diagnostics.Debug.WriteLine(ex);
        }
    }
}

Lastly, switch the build target to iOS Simulator and run the project.

Run the Project

This will show you how to run the project and perform OCR.

Execute .NET MAUI App project

Download .NET MAUI App Project

You can download the complete code for this guide. It comes as a zipped file that you can open in Visual Studio as a .NET MAUI App project.

Click here to download the project.

Using IronOcr.iOS in Avalonia

Setting up IronOcr.iOS in Avalonia is similar to MAUI, with one crucial difference: in addition to the latest .NET SDK version, you also need .NET SDK 8.0.101 installed to run IronOcr.iOS successfully. Afterward, IronOcr.iOS can be used in an Avalonia project with the same setup as described above.

If you want to perform OCR on Android, navigate to the following article to learn more: "How to Perform OCR on Android in .NET MAUI"

Frequently Asked Questions

What is IronOCR used for on iOS in .NET MAUI?

IronOCR is used to perform Optical Character Recognition (OCR) on iOS devices within .NET MAUI applications. It allows developers to extract text from images seamlessly.

How do I install the IronOCR package for iOS?

To install the IronOCR package for iOS, use the NuGet Package Manager in Visual Studio. Search for 'IronOcr.iOS' in the 'Browse' tab and add it to your project.

Can I use IronOCR for PDF document processing on iOS?

As of now, IronOCR for iOS is limited to processing image files. It does not support PDF document processing.

What are the basic steps to implement OCR using IronOCR on iOS?

First, set up a .NET MAUI project, then download and install IronOcr.iOS via NuGet. Configure your project files properly, instantiate IronTesseract, and use it to process images for text extraction.

Do I need to include IronOCR in platform-specific ways in a MAUI project?

Yes, to prevent conflicts, modify your project file to include IronOCR only when targeting iOS. This ensures that the package is not mistakenly used on other platforms like Android.

Is there a sample project available for IronOCR on iOS?

Yes, a sample .NET MAUI App project for IronOCR on iOS is available for download, providing a ready-to-run example of how to implement OCR functionality.

What is required for using IronOCR iOS in Avalonia?

In addition to the usual setup, you'll need .NET SDK version 8.0.101 installed alongside the latest .NET SDK to run IronOCR iOS in an Avalonia project.

How do I ensure IronOCR is not included in non-iOS builds?

Edit the csproj file to create a conditional ItemGroup that includes the IronOCR package reference only if the target framework is iOS.

How does the Image input and OCR process work in IronOCR for iOS?

In IronOCR, an image stream is loaded into an OcrInput object. This object is then processed by an IronTesseract instance to extract text, which can be displayed in your application's UI.

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

Ready to Get Started?

Nuget Downloads 6,236,385Version:2026.9just released

Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronOcr
nuget.org/packages/IronOcr/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronOCR"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronOCR to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronOCR.dll"

Licenses from $999

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
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