How can I help you?
Getting Started with .NET MAUI PDF Viewer
26 Jun 202621 minutes to read
This section guides you through setting up and configuring the PDF Viewer in your .NET MAUI application. Follow the steps below to add the PDF Viewer to your project and load a PDF document.
To get started quickly, you can also check out our video tutorial below.
Prerequisites
Before proceeding, ensure the following are in place:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with Visual Studio 2022 (v17.3 or later).
Step 1: Create a New MAUI Project
- Go to File > New > Project and choose the .NET MAUI App template.
- Name the project and choose a location, then click Next.
- Select the .NET Framework version and click Create.
Step 2: Install the Syncfusion® MAUI PDF Viewer NuGet Package
- In Solution Explorer, right-click the project and choose Manage NuGet Packages.
- Search for Syncfusion.Maui.PdfViewer and install the latest version.
- Ensure the dependencies are installed and the project is restored.
Step 3: Register the Syncfusion® Core Handler
Syncfusion.Maui.Core is automatically installed as a dependency when Syncfusion.Maui.PdfViewer NuGet is installed.
- Add the following namespace in your
MauiProgram.csfile.
using Syncfusion.Maui.Core.Hosting;- Register the Syncfusion core handler in your
MauiProgram.csfile to use Syncfusion controls.
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
builder.ConfigureSyncfusionCore();
return builder.Build();
}Step 4: Add PDF Viewer
Open the MainPage.xaml file and follow the steps below.
- Add the following namespace in your MainPage.xaml file.
xmlns:syncfusion="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer"- Add the SfPdfViewer control.
<syncfusion:SfPdfViewer x:Name="pdfViewer"></syncfusion:SfPdfViewer>Step 5: Load a PDF Document
- From the solution explorer of the project, add a new folder to the project named
Assetsand add the PDF document you need to load into the PDF viewer. Here, a PDF document namedPDF_Succinctly.pdfis used. - In Visual Studio, right-click the added PDF document and set its
Build ActionasEmbedded Resource. - In this example, the PDF document is loaded using MVVM binding. Create a new C# file named
PdfViewerViewModel.csand add the following code snippet.
using System.ComponentModel;
using System.Reflection;
internal class PdfViewerViewModel : INotifyPropertyChanged
{
private Stream pdfDocumentStream;
/// <summary>
/// Occurs when a property value changes.
/// </summary>
public event PropertyChangedEventHandler? PropertyChanged;
/// <summary>
/// Gets or sets the stream of the currently loaded PDF document.
/// </summary>
public Stream PdfDocumentStream
{
get
{
return pdfDocumentStream;
}
set
{
pdfDocumentStream = value;
OnPropertyChanged(nameof(PdfDocumentStream));
}
}
/// <summary>
/// Initializes a new instance of the <see cref="PdfViewerViewModel"/> class.
/// </summary>
public PdfViewerViewModel()
{
// Load the embedded PDF document stream.
// Replace 'PdfViewerExample' with your project's namespace in resource path
pdfDocumentStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("PdfViewerExample.Assets.PDF_Succinctly.pdf");
}
/// <summary>
/// Raises the <see cref="PropertyChanged"/> event for the specified property name.
/// </summary>
/// <param name="name">The name of the property that changed.</param>
public void OnPropertyChanged(string name)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}- Open the
MainPage.xamlfile again and add the namespacePdfViewerExampleand name it aslocal.
xmlns:local="clr-namespace:PdfViewerExample"- Set an instance of the
PdfViewerViewModelclass as theBindingContext. Bind the PDF viewer’s DocumentSource to thePdfDocumentStreamproperty of thePdfViewerViewModelclass.
<ContentPage.BindingContext>
<local:PdfViewerViewModel x:Name="viewModel" />
</ContentPage.BindingContext>
<syncfusion:SfPdfViewer x:Name="pdfViewer" DocumentSource="{Binding PdfDocumentStream}"/>NOTE
- While changing or opening different documents on the same page, the previously loaded document will be unloaded automatically by the SfPdfViewer.
- If you are using multiple pages in your application, then make sure to unload the document from the SfPdfViewer while leaving the page that has it to release the memory and resources consumed by the PDF document that is loaded. The unloading of documents can be done by calling the UnloadDocument method.
Step 6: Running the Application
- Select the target framework, device or emulator.
- Press
F5to run the application. - The PDF document will be loaded in the PDF viewer control as shown in the following screenshot.
Prerequisites
Before proceeding, ensure the following are in place:
- Install .NET 9 SDK or later.
- Set up a .NET MAUI environment with Visual Studio Code.
- Ensure that the .NET MAUI workload is installed and configured as described here.
Step 1: Create a New MAUI Project
- Open the command palette by pressing
Ctrl+Shift+Pand type .NET:New Project and enter. - Choose the .NET MAUI App template.
- Select the project location, type the project name and press enter.
- Then choose Create project.
Step 2: Install the Syncfusion® MAUI PDF Viewer NuGet Package
- In Solution Explorer, right-click the project and choose Add NuGet Package.
- Search for Syncfusion.Maui.PdfViewer and install the latest version.
- Ensure the dependencies are installed, and the project is restored.
Step 3: Register the Syncfusion® Core Handler
Syncfusion.Maui.Core will be automatically installed as a dependency when Syncfusion.Maui.PdfViewer NuGet is installed.
- Add the following namespace in your
MauiProgram.csfile.
using Syncfusion.Maui.Core.Hosting;- Register the Syncfusion core handler in your
MauiProgram.csfile to use Syncfusion controls.
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
builder.ConfigureSyncfusionCore();
return builder.Build();
}Step 4: Add PDF Viewer
Open the MainPage.xaml file and follow the steps below.
- Add the following namespace in your MainPage.xaml file.
- Add the SfPdfViewer control.
<syncfusion:SfPdfViewer x:Name="pdfViewer"></syncfusion:SfPdfViewer>Step 5: Load a PDF Document
- From the solution explorer of the project, add a new folder to the project named
Assetsand add the PDF document you need to load into the PDF viewer. Here, a PDF document namedPDF_Succinctly.pdfis used. - Open the
.csprojfile and add the following code snippet to embed the PDF document as a resource.
<ItemGroup>
<EmbeddedResource Include="Assets\PDF_Succinctly.pdf" />
</ItemGroup>- In this example, the PDF document is loaded using MVVM binding. Create a new C# file named
PdfViewerViewModel.csand add the following code snippet.
using System.ComponentModel;
using System.Reflection;
internal class PdfViewerViewModel : INotifyPropertyChanged
{
private Stream pdfDocumentStream;
/// <summary>
/// Occurs when a property value changes.
/// </summary>
public event PropertyChangedEventHandler? PropertyChanged;
/// <summary>
/// Gets or sets the stream of the currently loaded PDF document.
/// </summary>
public Stream PdfDocumentStream
{
get
{
return pdfDocumentStream;
}
set
{
pdfDocumentStream = value;
OnPropertyChanged(nameof(PdfDocumentStream));
}
}
/// <summary>
/// Initializes a new instance of the <see cref="PdfViewerViewModel"/> class.
/// </summary>
public PdfViewerViewModel()
{
// Load the embedded PDF document stream.
// Replace 'PdfViewerExample' with your project's namespace in resource path
pdfDocumentStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("PdfViewerExample.Assets.PDF_Succinctly.pdf");
}
/// <summary>
/// Raises the <see cref="PropertyChanged"/> event for the specified property name.
/// </summary>
/// <param name="name">The name of the property that changed.</param>
public void OnPropertyChanged(string name)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}- Open the
MainPage.xamlfile again and add the namespacePdfViewerExampleand name it aslocal.
xmlns:local="clr-namespace:PdfViewerExample"- Set an instance of the
PdfViewerViewModelclass as theBindingContext. Bind the PDF viewer’s DocumentSource to thePdfDocumentStreamproperty of thePdfViewerViewModelclass.
<ContentPage.BindingContext>
<local:PdfViewerViewModel x:Name="viewModel" />
</ContentPage.BindingContext>
<syncfusion:SfPdfViewer x:Name="pdfViewer" DocumentSource="{Binding PdfDocumentStream}"/>NOTE
- While changing or opening different documents on the same page, the previously loaded document will be unloaded automatically by the SfPdfViewer.
- If you are using multiple pages in your application, then make sure to unload the document from the SfPdfViewer while leaving the page that has it to release the memory and resources consumed by the PDF document that is loaded. The unloading of documents can be done by calling the UnloadDocument method.
Step 6: Running the Application
- Select the target framework, device or emulator.
- Press
F5to run the application. - The PDF document will be loaded in the PDF viewer control as shown in the following screenshot.
Prerequisites
Before proceeding, ensure the following are set up:
- Ensure you have the latest version of JetBrains Rider.
- Install .NET 9 SDK or later.
- Make sure the MAUI workloads are installed and configured as described here.
Step 1: Create a new .NET MAUI Project
- Go to File > New Solution, Select .NET (C#), and choose the .NET MAUI App template.
- Enter the Project Name, Solution Name, and Location.
- Select the .NET Framework version and click Create.
Step 2: Install the Syncfusion® MAUI PDF Viewer NuGet Package
- In Solution Explorer, right-click the project and choose Manage NuGet Packages.
- Search for Syncfusion.Maui.PdfViewer and install the latest version.
- Ensure the dependencies are installed, and the project is restored. If not, open the Terminal in Rider and manually run the following code.
dotnet restoreStep 3: Register the Syncfusion® Core Handler
Syncfusion.Maui.Core is a dependency for all MAUI Syncfusion controls. This package will be automatically installed as a dependency when Syncfusion.Maui.PdfViewer NuGet is installed.
- Add the following namespace in your
MauiProgram.csfile.
using Syncfusion.Maui.Core.Hosting;- Register the Syncfusion core handler in your
MauiProgram.csfile to use Syncfusion controls.
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
builder.ConfigureSyncfusionCore();
return builder.Build();
}Step 4: Add PDF Viewer
Open the MainPage.xaml file and follow the steps below.
- Add the following namespace in your MainPage.xaml file.
xmlns:syncfusion="clr-namespace:Syncfusion.Maui.PdfViewer;assembly=Syncfusion.Maui.PdfViewer"- Add the SfPdfViewer control. Name the PDF viewer control as
pdfViewer.
<syncfusion:SfPdfViewer x:Name="pdfViewer"></syncfusion:SfPdfViewer>Step 5: Load a PDF Document
- From the solution explorer of the project, add a new folder to the project named
Assetsand add the PDF document you need to load into the PDF viewer. Here, a PDF document namedPDF_Succinctly.pdfis used. - Open the
.csprojfile and add the following code snippet to embed the PDF document as a resource.
<ItemGroup>
<EmbeddedResource Include="Assets\PDF_Succinctly.pdf" />
</ItemGroup>- In this example, the PDF document is loaded using MVVM binding. Create a new C# file named
PdfViewerViewModel.csand add the following code snippet.
using System.ComponentModel;
using System.Reflection;
internal class PdfViewerViewModel : INotifyPropertyChanged
{
private Stream pdfDocumentStream;
/// <summary>
/// Occurs when a property value changes.
/// </summary>
public event PropertyChangedEventHandler? PropertyChanged;
/// <summary>
/// Gets or sets the stream of the currently loaded PDF document.
/// </summary>
public Stream PdfDocumentStream
{
get
{
return pdfDocumentStream;
}
set
{
pdfDocumentStream = value;
OnPropertyChanged(nameof(PdfDocumentStream));
}
}
/// <summary>
/// Initializes a new instance of the <see cref="PdfViewerViewModel"/> class.
/// </summary>
public PdfViewerViewModel()
{
// Load the embedded PDF document stream.
// Replace 'PdfViewerExample' with your project's namespace in resource path
pdfDocumentStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("PdfViewerExample.Assets.PDF_Succinctly.pdf");
}
/// <summary>
/// Raises the <see cref="PropertyChanged"/> event for the specified property name.
/// </summary>
/// <param name="name">The name of the property that changed.</param>
public void OnPropertyChanged(string name)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}- Open the
MainPage.xamlfile again and add the namespacePdfViewerExampleand name it aslocal.
xmlns:local="clr-namespace:PdfViewerExample"- Set an instance of the
PdfViewerViewModelclass as theBindingContext. Bind the PDF viewer’s DocumentSource to thePdfDocumentStreamproperty of thePdfViewerViewModelclass.
<ContentPage.BindingContext>
<local:PdfViewerViewModel x:Name="viewModel" />
</ContentPage.BindingContext>
<syncfusion:SfPdfViewer x:Name="pdfViewer" DocumentSource="{Binding PdfDocumentStream}"/>NOTE
- While changing or opening different documents on the same page, the previously loaded document will be unloaded automatically by the SfPdfViewer.
- If you are using multiple pages in your application, then make sure to unload the document from the SfPdfViewer while leaving the page that has it to release the memory and resources consumed by the PDF document that is loaded. The unloading of documents can be done by calling the UnloadDocument method.
Step 6: Running the Application
- Select the target framework, device or emulator.
- Press Run or use the toolbar run button to build and launch the application.
- The PDF document will be loaded in the PDF viewer control as shown in the following screenshot.

The Getting Started example project for the .NET MAUI PDF Viewer can be downloaded here.
NOTE
You can refer to our .NET MAUI PDF Viewer feature tour page for its groundbreaking feature representations. You can also explore our .NET MAUI PDF Viewer Example that shows you how to render the PDF Viewer in .NET MAUI.
What to Do Next
Now that the PDF Viewer is running, you can explore the following features:
| Topics | Resources |
|---|---|
| Open documents from different sources | Load a PDF from a URL, the device’s file system, a Base64 string, or a password-protected file. → Open a Document |
| Navigate and read | Jump to specific pages, control zoom levels, and search for text. → Page Navigation · Magnification · Text Search |
| Add annotations | Highlight text, draw shapes, add sticky notes, or use freehand ink. → Annotations Overview |
| Fill form fields | Read, edit, validate, import, and export PDF form data. → Form Filling Overview |
| Save and print | Persist changes back to a file stream, optionally flattening annotations. → Save a Document · Print a Document |
| Customize the toolbar | Show, hide, add, or remove toolbar items to match your app’s workflow. → Toolbar Customization |
| Redact sensitive content | Permanently remove confidential text or images before sharing. → Redaction |
- For migration from Xamarin to .NET MAUI, please follow the Migration Guide.