Viewing PDFs in MAUI for C# .NET

IronPDF Viewer Banner

In the modern era of cross-platform development, providing users with the ability to view PDF documents directly within your app is not just a convenience, but a necessity. With the IronPDF Viewer, you can embed PDF viewing functionality into your MAUI application.

In this article, we will learn how to integrate IronPDF Viewer within a MAUI application to allow users the ability to view, save, and print PDFs.


Download and Install the IronPDF Viewer Library

Visual Studio - NuGet Package Manager

In Visual Studio, right-click on your project solution explorer and select Manage NuGet Packages..., From there, you can search for IronPdf.Viewer.Maui and install the latest version to your solution. Alternatively, you can open the NuGet Package Manager console by navigating to Tools > NuGet Packet Manager > Package Manager Console and entering the following command:

Install-Package IronPdf.Viewer.Maui
C# NuGet Library for PDF

Install with NuGet

Install-Package IronPdf.Viewer.Maui

Download DLL

Download DLL

Manually install into your project

Integrate IronPDF Viewer into a MAUI Application

In the following sections, we will demonstrate how to integrate IronPDF Viewer into a default MAUI application.


Before adding IronPDF Viewer to your MAUI project, first ensure it does not target the iOS and Android platforms. You can check this by right-clicking on the project file and selecting Properties. Uncheck the Target the iOS Platform and Target the Android platform checkboxes underlined in the image below if they are not unchecked already. For this change to be successfully implemented, you may need to save the project after unchecking and restart Visual Studio.

Properties Screen

After untargeting the iOS and Android platforms, go to your MauiProgram.cs file and add the following code to initialize the viewer:

using IronPdf.Viewer.Maui;

public static class MauiProgram
    public static MauiApp CreateMauiApp()
        var builder = MauiApp.CreateBuilder();
            // other configuration options ...
            .ConfigureIronPdfView(); // configure the viewer on app start-up

        return builder.Build();
Imports IronPdf.Viewer.Maui

Public Module MauiProgram
	Public Function CreateMauiApp() As MauiApp
		Dim builder = MauiApp.CreateBuilder()
		builder.UseMauiApp(Of App)().ConfigureIronPdfView() ' configure the viewer on app start-up

		Return builder.Build()
	End Function
End Module
VB   C#

By default, the IronPDF Viewer will display a banner at the bottom-right of the view. To remove this view, add your IronPDF (or Iron Suite) license key to ConfigureIronPdfView like so:

VB   C#

Add a PDF Viewer Page

In this section, we will learn how to create a PDF Viewer page, integrate IronPDF Viewer, and create a tab for it in a MAUI application. We will demonstrate how to do this with both a XAML and C# ContentPage.


  1. Add a new page into your project by right-clicking on your project, then navigate to Add > New Item... Add New Item

  2. Navigate to the .NET MAUI section. To create a XAML page, select .NET MAUI ContentPage (XAML). For a C# file, select .NET MAUI ContentPage (C#). Give your file the name PdfViewerPage, then click Add. .NET MAUI `ContentPage`

  3. In the XAML file, add the following code and save:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage ...
    <ipv:IronPdfView x:Name="pdfView"/>

If you created a C# ContentPage instead, add the following code instead and save:

using IronPdf.Viewer.Maui;

public class MainPage : ContentPage
    private readonly IronPdfView pdfView;

    public MainPage()

        this.pdfView = new IronPdfView { Options = IronPdfViewOptions.All };

        Content = this.pdfView;
Imports IronPdf.Viewer.Maui

Public Class MainPage
	Inherits ContentPage

	Private ReadOnly pdfView As IronPdfView

	Public Sub New()

		Me.pdfView = New IronPdfView With {.Options = IronPdfViewOptions.All}

		Content = Me.pdfView
	End Sub
End Class
VB   C#
  1. In your AppShell.xaml file, add the following:
<?xml version="1.0" encoding="UTF-8" ?>
<Shell ...
  <TabBar x:Name="AppTabBar">
      <Tab Title="Home">
        <ShellContent ContentTemplate="{DataTemplate local:MainPage}" Route="MainPage"/>
      <Tab Title="PDF Viewer">
        <ShellContent ContentTemplate="{DataTemplate local:PdfViewerPage}" Route="PDFViewer"/>
  1. Save your project, then build and run. You should see tabs in the top-left corner as shown below, and clicking on the "PDF Viewer" tab should open the IronPDF Viewer.

IronPDF Viewer Default

Load a PDF on Start-Up

On the start-up of the application, IronPDF Viewer will prompt the user to open a PDF by default. It is possible for it to open a PDF automatically on start-up, as well. There are three ways in which you can load a PDF on start-up: by a filename, through a byte array, and through a stream.

Load by Filename

To load a PDF by filename, you could specify the source of the PDF file in the IronPdfView tag in the XAML file. An example of this is shown below:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage ...
    <ipv:IronPdfView Source="C:/path/to/my/example.pdf" />

Alternatively, you can load the PDF by filename by using the IronPdfViewSource.FromFile method in a C# ContentPage:

// We assume an IronPdfView instance is created previously called pdfView
pdfView.Source = IronPdfViewSource.FromFile("C:/path/to/my/example.pdf");
' We assume an IronPdfView instance is created previously called pdfView
pdfView.Source = IronPdfViewSource.FromFile("C:/path/to/my/example.pdf")
VB   C#

Load Through Byte Array

For some use cases, it may be desirable to load a byte array of a PDF. This is not possible from XAML, but is possible in C#. You can achieve this by simply using the IronPdfViewSource.FromBytes method. An example of how to use this method is shown below:

pdfView.Source = IronPdfViewSource.FromBytes(File.ReadAllBytes("~/Downloads/example.pdf"));
pdfView.Source = IronPdfViewSource.FromBytes(File.ReadAllBytes("~/Downloads/example.pdf"))
VB   C#

Load Through Stream

Similarly, it may be more desirable for PDFs to be loaded through a stream in some use cases. This is not possible from XAML, but is possible in C#. You can achieve this by simply using the IronPdfViewSource.FromStream method. An example of how to use this method is shown below:

pdfView.Source = IronPdfViewSource.FromStream(File.OpenRead("~/Downloads/example.pdf"));
pdfView.Source = IronPdfViewSource.FromStream(File.OpenRead("~/Downloads/example.pdf"))
VB   C#

Configure the Toolbar

With IronPDF Viewer, you can choose what options to display in the toolbar. The choice of options available are:

  • Thumbnail view
  • Filename display
  • Text search
  • Page number navigation
  • Zoom
  • Fit to width
  • Fit to height
  • Rotate clockwise
  • Rotate counterclockwise
  • Open file
  • Download file
  • Print file
  • Display annotations
  • Two-page view

By default, IronPDF Viewer will display the toolbar shown below:

Default Toolbar

In the default view, the filename display, text search, and rotate counterclockwise options are all disabled. To display everything, set the Option parameter of the IronPdfView tag in the XAML to be All:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage ...
    <ipv:IronPdfView x:Name="pdfView" Options="All"/>

Alternatively, you could achieve the same in C#:

pdfView.Options = IronPdfViewOptions.All;
pdfView.Options = IronPdfViewOptions.All
VB   C#

Which will display the following:

All Toolbar

If you don't want to display anything, set the option to None. The toolbar will not appear if Options are set to this:

No Toolbar

You can choose which specific options you would like to display. For instance, if you wanted to display only the thumbnail and open file options, modify the Options parameter of IronPdfView in XAML like so:

<ipv:IronPdfView x:Name="pdfView" Options="Thumbs, Open"/>

Similarly, in C#:

pdfView.Options = IronPdfViewOptions.Thumbs | IronPdfViewOptions.Open;
pdfView.Options = IronPdfViewOptions.Thumbs Or IronPdfViewOptions.Open
VB   C#

Which will display the following:

Toolbar with thumbnail and open file options


In this tutorial, we learned how to integrate IronPDF Viewer into a MAUI application and how to customize its toolbar to best your needs.

This viewer comes with our IronPDF product. If you would like to make a feature request or have any general questions about IronPDF Viewer (or IronPDF), please contact our support team. We will be more than happy to assist you.