IRONSOFTWAREHOME
USING IRONPDF

How to Display PDF Embedded Text in .NET MAUI

Curtis Chau
Curtis Chau
Updated: August 1, 2026

Learn how to extract and display embedded text from PDF files in .NET MAUI applications using IronPDF. This powerful C# library enables you to read PDF content and present it in cross-platform apps with just a few lines of code.

.NET Multi-platform App UI (MAUI) simplifies multi-platform app development. With this evolution of Xamarin.Forms, you can create apps for Android, iOS, macOS, and Windows from a single project. PDF files, known for preserving fonts, images, and layout, are commonly managed using this technology.

The IronPDF library offers powerful PDF handling capabilities. You can leverage IronPDF to work with embedded text effortlessly, simplifying the process of generating and manipulating PDF files while maintaining consistent rendering with default settings.

What Is PDF Embedded Text and Font Embedding?

PDF-embedded text refers to text entities embedded in a PDF file. It ensures consistency and accurate rendering across PDF viewer applications, including Adobe InDesign. By embedding fonts within the PDF document, the correct fonts are preserved, regardless of the viewer application or whether the specific font is installed on the viewer's device.

Embedding fonts can increase file size, but it's crucial for maintaining the original document's appearance. Adobe PDF settings often determine whether fonts are embedded. PDF compression techniques can help reduce file size when embedding fonts.

There are three types of embedded fonts in PDFs:

  1. Embedded fonts: The entire font is embedded in the document.
  2. Subset embedded fonts: Only a subset of the fonts used in the original document is embedded.
  3. No embedded fonts: No fonts are embedded in the document.

In Adobe Acrobat, you can verify font embedding by checking the document properties. By default, fonts are embedded in PDFs. However, these settings can be modified using Adobe Acrobat Pro or tools like IronPDF's font management features.

A 'flattened PDF' contains all embedded fonts, making it self-contained and ensuring consistent appearance across all systems. IronPDF supports flattening PDF documents to ensure consistent rendering.

What Is IronPDF C#?

IronPDF Documentation is a powerful C# PDF library that allows you to generate, read, and edit PDF files in .NET applications. You can generate PDF files from HTML with IronPDF.

A key feature is working with embedded text in PDF files. Embedding fonts in PDFs preserves the document's original appearance, even when viewed on systems without the original fonts. Let's explore how to display embedded text using IronPDF in .NET MAUI.

IronPDF offers extensive text extraction capabilities for working with PDF content programmatically. Whether you need to parse PDFs in C# or convert PDF content to other formats, IronPDF provides the necessary tools.

  1. .NET MAUI: Microsoft's unified UI toolkit that allows you to create apps for Android, iOS, macOS, and Windows with a single shared codebase. You can download the .NET MAUI from the Microsoft website.
  2. Visual Studio 2022 (or later): A powerful and user-friendly Integrated Development Environment (IDE) for .NET programming. You can download Visual Studio from the Microsoft website. Ensure you have the .NET MAUI workloads installed on Visual Studio 2022.
  3. IronPDF library: This is a PDF processing library for .NET, and we will use it to interact with the PDF files. You can install IronPDF via NuGet, which is a package manager for the Microsoft development platform.
  4. An Adobe PDF file: For the sake of this tutorial, we will need a PDF file.

Before starting, ensure you have these requirements:

  1. .NET MAUI: Microsoft's unified UI toolkit for creating cross-platform apps. Download from Microsoft's website.
  2. Visual Studio 2022 (or later): A powerful IDE for .NET programming with .NET MAUI workloads installed.
  3. IronPDF library: Install via NuGet package manager. Learn about IronPDF NuGet packages.
  4. A PDF file: Any PDF file for testing purposes.

For platform-specific setup:

How Do I Create a .NET MAUI App?

Follow these steps to create a new .NET MAUI App:

Launch Visual Studio 2022: After launching, navigate to File > New > Project. In the project template window, select .NET MAUI App and then click on Next.

Visual Studio's New Project dialog showing various .NET MAUI project templates including .NET MAUI App, .NET MAUI Blazor App, and .NET MAUI Class Library options. Figure 1: The Visual Studio New Project dialog with .NET MAUI templates highlighted, showing the first step in creating a new .NET MAUI application.

Name your project: In the next window, you'll need to give your project a name. Let's name it IronPDF_Read_and_View. Choose a location to save your project and then click Next.

Visual Studio configuration screen for creating a new .NET MAUI App project named 'IronPDF Read and View' with platform options for Android, iOS, Mac Catalyst, macOS, MAUI, Tizen, and Windows. Figure 2: Configure the project - Setting up a new .NET MAUI application with IronPDF integration for cross-platform PDF viewing capabilities.

Select Framework: Select .NET Framework from the drop-down list. Select the latest .NET Framework for a smooth process and click the "Create" button.

Visual Studio project creation wizard showing .NET MAUI App configuration with .NET 7.0 framework selected and platform options for Android, iOS, Mac Catalyst, macOS, MAUI, Tizen, and Windows Figure 3: Selecting the .NET framework version and target platforms for a new .NET MAUI application

How Do I Install IronPDF?

After creating the .NET MAUI App, install the IronPDF library:

  1. Open the NuGet Package Manager: Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

    Visual Studio Tools menu expanded showing NuGet Package Manager options with 'Manage NuGet Packages for Solution' highlighted Figure 4: Access the NuGet Package Manager by navigating to Tools > NuGet Package Manager > Manage NuGet Packages for Solution in Visual Studio

  2. Search for IronPDF: In the opened window, click on Browse and type IronPDF in the search box.

    NuGet Package Manager interface in Visual Studio showing search results for 'IronPDF' with multiple package options and the main IronPDF package selected for installation Figure 5: The NuGet Package Manager UI displaying IronPDF search results. The main IronPDF package (version 2023.6.10) is selected and ready to install, with 6.31M downloads shown.

  3. Install IronPDF: Once you see IronPDF in the search results, click on it. Make sure that the checkbox for your project in the right panel is checked and then click on Install.

Accept any prompts during installation.

You can also install using the Package Manager Console:

PM > Install-Package IronPdf

For advanced installation options, including Docker setup and Azure deployment, see the IronPDF installation overview.

How Do I Build the User Interface?

Let's build the UI for our application. The MainPage.xaml file will have a button to open PDFs and labels to display the file name and content.

Open the MainPage.xaml file: This file contains the layout of the main page. You can find this file under the Pages folder in the Solution Explorer.

Define the Layout: We are going to use a <ScrollView> control which allows the user to scroll through the contents of the page when it cannot fit entirely on the screen. Inside the ScrollView, we will use a <StackLayout> for stacking our controls vertically. Inside the StackLayout, we have three <Frame> controls. Each Frame is used to hold a distinct section of our page, providing a neat and organized appearance.

Add Controls: The first Frame has a <VerticalStackLayout> which holds a Label and a Button. The Label displays the application name, and the Button allows the user to open a PDF file. The Clicked attribute is assigned the method OpenAndReadFile which will be defined later in the code-behind file.

<VerticalStackLayout
    Spacing="25"
    Padding="30,0"
    VerticalOptions="Center">
    <Label
        Text="IronPDF MAUI Application"
        SemanticProperties.HeadingLevel="Level1"
        SemanticProperties.Description="IronPDF MAUI Application"
        FontSize="30"
        HorizontalOptions="Center"
        FontAttributes="Bold"

    />
    <Button
        x:Name="openFileBtn"
        Text="Open PDF File"
        SemanticProperties.Hint="Open PDF File"
        Clicked="OpenAndReadFile"
        HorizontalOptions="Center" />
</VerticalStackLayout>
XML

The second Frame uses <HorizontalStackLayout> with two Labels: one for static text and another named fileName for displaying the selected file.

<HorizontalStackLayout
    Spacing="25"
    Padding="30,0"
    VerticalOptions="Center">
    <Label
        Text="Selected File Name: "
        SemanticProperties.HeadingLevel="Level2"
        SemanticProperties.Description="Selected File Name"
        FontSize="18"
        HorizontalOptions="Center"
        FontAttributes="Bold"
    />
    <Label
        x:Name="fileName"
        Text=""
        SemanticProperties.HeadingLevel="Level3"
        SemanticProperties.Description="Selected File Name"
        FontSize="18"
        HorizontalOptions="Center" 
     />
</HorizontalStackLayout>
XML

The third Frame contains a <VerticalStackLayout> with two Labels: one for "PDF Content" and another named content for displaying the PDF text.

<VerticalStackLayout>
    <Label
        Text="PDF Content"
        SemanticProperties.HeadingLevel="Level2"
        FontSize="25"
        FontAttributes="Bold"
        HorizontalOptions="Center" 
    />
    <Label
        x:Name="content"
        FontSize="18"
        HorizontalTextAlignment="Start"
    />
</VerticalStackLayout>
XML

Your complete MainPage.xaml should look like this:

<?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="IronPDF_Read_and_View.MainPage">
    <ScrollView>
        <StackLayout>
            <Frame>
                <VerticalStackLayout
                    Spacing="25"
                    Padding="30,0"
                    VerticalOptions="Center">
                    <Label
                        Text="IronPDF MAUI Application"
                        SemanticProperties.HeadingLevel="Level1"
                        SemanticProperties.Description="IronPDF MAUI Application"
                        FontSize="30"
                        HorizontalOptions="Center"
                        FontAttributes="Bold"

                    />
                    <Button
                        x:Name="openFileBtn"
                        Text="Open PDF File"
                        SemanticProperties.Hint="Open PDF File"
                        Clicked="OpenAndReadFile"
                        HorizontalOptions="Center" />
                </VerticalStackLayout>
            </Frame>
            <Frame>
                <HorizontalStackLayout
                        Spacing="25"
                        Padding="30,0"
                        VerticalOptions="Center">
                    <Label
                            Text="Selected File Name: "
                            SemanticProperties.HeadingLevel="Level2"
                            SemanticProperties.Description="Selected File Name"
                            FontSize="18"
                            HorizontalOptions="Center"
                            FontAttributes="Bold"

                        />
                    <Label
                            x:Name="fileName"
                            Text=""
                            SemanticProperties.HeadingLevel="Level3"
                            SemanticProperties.Description="Selected File Name"
                            FontSize="18"
                            HorizontalOptions="Center" 
                        />
                </HorizontalStackLayout>
            </Frame>
            <Frame>
                <VerticalStackLayout>
                    <Label
                            Text="PDF Content"
                            SemanticProperties.HeadingLevel="Level2"
                            FontSize="25"
                        FontAttributes="Bold"
                            HorizontalOptions="Center" 
                        />
                    <Label
                        x:Name="content"
                        FontSize="18"
                        HorizontalTextAlignment="Start"
                        />
                </VerticalStackLayout>
            </Frame>
        </StackLayout>
    </ScrollView>
</ContentPage>
XML

When users click "Open PDF File", it triggers the OpenAndReadFile method. The fileName and content labels will display the selected file name and PDF content respectively.

For complex UI layouts, IronPDF supports converting XAML to PDF directly in MAUI applications.

What Goes in the Code Behind MainPage.xaml.cs?

Open MainPage.xaml.cs: Find this file in the Solution Explorer under the Pages folder. This is where we'll add our method.

Add the filePath field: At the top of the MainPage class, declare a string field named filePath. We will use this field to store the path of the selected file.

string filePath = string.Empty;

Initialize Components: In the MainPage constructor, call the InitializeComponent method. This method is called automatically to initialize the page and its controls.

public MainPage()
{
    InitializeComponent();
}

Implement the OpenAndReadFile method: This method is marked as async because we're going to use the await keyword inside it. The FilePicker.PickAsync method is used to open the file picker. When the user selects a file, the file name is stored in the fileName label, and the file path in the filePath field. The IronPDF library is used to open the PDF document and extract all text from it. The extracted text is then assigned to the content label.

private async void OpenAndReadFile(object sender, EventArgs e)
{
    FileResult result = await FilePicker.PickAsync();
    fileName.Text = result.FileName;
    filePath = result.FullPath;

    IronPdf.License.LicenseKey = "Your-License-Key";

    // Read PDF File
    var document = PdfDocument.FromFile(filePath);
    var pdfContent = document.ExtractAllText();
    content.Text = pdfContent;
}

Replace "Your-License-Key" with your actual IronPDF license key. Learn about using license keys in IronPDF.

Here's the complete code:

using IronPdf;

public partial class MainPage : ContentPage
{
    string filePath = string.Empty;

    public MainPage()
    {
        InitializeComponent();
    }

    private async void OpenAndReadFile(object sender, EventArgs e)
    {
        FileResult result = await FilePicker.PickAsync();
        fileName.Text = result.FileName;
        filePath = result.FullPath;
        IronPdf.License.LicenseKey = "Your-License-Key";

        // Read PDF File
        var document = PdfDocument.FromFile(filePath);
        var pdfContent = document.ExtractAllText();
        content.Text = pdfContent;
    }
}

IronPDF offers additional features beyond text extraction. You can search and replace text, extract images, work with PDF forms, and add annotations programmatically.

How Do I Run the Application?

Start the Application: To run the application, you can either press F5 on your keyboard or click on the green 'Start Debugging' button in the toolbar at the top of Visual Studio. Ensure that the right target device or emulator is selected in the dropdown menu next to the 'Start Debugging' button.

Use the Application: Once the application launches, you will see a screen with the title "IronPDF MAUI Application" and a button labeled "Open PDF File".

Use the Application: You'll see a screen with "IronPDF MAUI Application" and an "Open PDF File" button.

Open a PDF File: Click on the "Open PDF File" button. This will open a file picker, allowing you to browse and select a PDF file from your device or emulator.

Open a PDF File: Click "Open PDF File" to open the file picker and select a PDF from your device.

View the Content: Upon selecting a PDF file, the file name will be displayed under "Selected File Name:", and the content of the selected PDF file will be displayed under "PDF Content".

View the Content: After selecting a PDF, the file name appears under "Selected File Name:" and the extracted text under "PDF Content".

IronPDF MAUI application window showing extracted text content from an invoice PDF file, displaying invoice details including items, prices, and payment information. The IronPDF MAUI application successfully extracts and displays text content from a selected invoice PDF file, demonstrating the library's text extraction capabilities in a .NET MAUI desktop application.

Note that large PDFs may take a few seconds to process. The extracted text format may not match the original PDF layout exactly, as the ExtractAllText method extracts embedded text content. For more control, use page-specific extraction methods or work with PDF DOM objects.

What Have We Learned?

This tutorial showed how to build a .NET MAUI application using IronPDF to extract and display PDF text content. This demonstrates the power and versatility of .NET MAUI and IronPDF for PDF processing.

Beyond text extraction, IronPDF supports interacting with PDF forms, splitting PDFs, rasterizing pages to images, authentication with HTML login forms, customizing headers and footers, and supporting CSS for pixel-perfect PDFs. You can explore PDF viewing in MAUI, work with UTF-8 and international languages, and generate PDF reports from data.

IronPDF is a commercial product offering a free trial to test its capabilities. If you find it beneficial for production use, licenses start from $999. Check out the comprehensive IronPDF features overview to learn more about this powerful PDF processing library.

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