Vitvov.Maui.PDFView 1.8.4

dotnet add package Vitvov.Maui.PDFView --version 1.8.4
                    
NuGet\Install-Package Vitvov.Maui.PDFView -Version 1.8.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Vitvov.Maui.PDFView" Version="1.8.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vitvov.Maui.PDFView" Version="1.8.4" />
                    
Directory.Packages.props
<PackageReference Include="Vitvov.Maui.PDFView" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Vitvov.Maui.PDFView --version 1.8.4
                    
#r "nuget: Vitvov.Maui.PDFView, 1.8.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Vitvov.Maui.PDFView@1.8.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Vitvov.Maui.PDFView&version=1.8.4
                    
Install as a Cake Addin
#tool nuget:?package=Vitvov.Maui.PDFView&version=1.8.4
                    
Install as a Cake Tool

<img src="icon.png" width="32" /> Maui.PDFView

Library for display PDF files in .NET MAUI on Android, iOS, MacOS and Windows

NuGet NuGet Downloads License: MIT

last commit

Platform Android iOS MacOS Windows
Supported
.NET 9 .NET 10
1.7.3 1.8.0+

https://github.com/vitalii-vov/Maui.PDFView/assets/71486507/4977ede8-c8db-454f-930d-ba2ec704f16d

 <br>

Installation

Install-Package Vitvov.Maui.PDFView

 <br>

Usage

Add .UseMauiPdfView() to MauiProgram

using Maui.PDFView;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .UseMauiPdfView();   // <- Write this

        return builder.Build();
    }
}

 <br> Add PdfView to XAML

<ContentPage
    x:Class="Example.Business.UI.Pages.MainPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:pdf="clr-namespace:Maui.PDFView;assembly=Maui.PDFView">

    
    <pdf:PdfView
        IsHorizontal="{Binding IsHorizontal}"
        Uri="{Binding PdfSource}"
        MaxZoom="4"
        PageIndex="{Binding PageInex}"
        PageChangedCommand="{Binding PageChangedCommand}">
    </pdf:PdfView>

</ContentPage>

 <br> Set PdfSource in ViewModel

internal partial class MainPageViewModel : ObservableObject
{
    [ObservableProperty] private string? _pdfSource;

    [RelayCommand] private void ChangeUri()
    {
        try 
        {
            //  See the example project to understand how to work with paths.
            PdfSource = "/path/to/file.pdf";

            //  You can set the Uri property to null to clear the component.
            //PdfSource = null;
        }
        catch(Exception ex)
        {
             // handle exceptions
        }
    }
}

 <br>

Personalization

You can customize the way pages are displayed by modifying the PageAppearance property in the PdfView component.

<pdf:PdfView Uri="{Binding PdfSource}">

    
    <pdf:PdfView.PageAppearance>
        <pdf:PageAppearance 
            Margin="16,8" 
            ShadowEnabled="True"
            Crop="64,32"/>
    </pdf:PdfView.PageAppearance>

</pdf:PdfView>

 <br>

Helper classes implementing IPdfSource

The PdfView component works only with file paths. This is because the native platform components primarily operate with file paths, and handling different PDF data sources directly inside the component would significantly complicate the code.

Therefore, you must always provide a file path regardless of the form your PDF data takes—whether it’s a byte array, a stream, an asset, or a URL.

To simplify working with these data sources, the component includes helper classes that implement the IPdfSource interface:

  • AssetPdfSource
  • ByteArrayPdfSource
  • FilePdfSource
  • HttpPdfSource

Example of using PdfSource

[RelayCommand] private async Task UploadUri()
{      
    var source = new HttpPdfSource("https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf");
    PdfSource = await source.GetFilePathAsync();
}

[RelayCommand] private async Task UploadAsset()
{
    var source = new AssetPdfSource("Example.Resources.PDF.pdf2.pdf");
    PdfSource = await source.GetFilePathAsync();
}

You can also create your own implementation of the IPdfSource interface to address your specific needs.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-android36.0 is compatible.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-ios26.0 is compatible.  net10.0-maccatalyst was computed.  net10.0-maccatalyst26.0 is compatible.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net10.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.8.4 1,027 8/26/2026
1.8.3 404 8/8/2026
1.8.1 339 8/4/2026
1.8.0 3,196 5/25/2026
1.7.3 8,552 2/18/2026
1.7.2 1,676 1/21/2026
1.7.1-beta1 120 1/20/2026
1.6.0 3,871 11/7/2025
1.5.0 24,472 5/27/2025
1.4.0 272 5/25/2025
1.3.0 476 5/21/2025
1.2.2 2,283 4/19/2025
1.2.1 765 4/15/2025
1.2.0 1,028 3/14/2025
1.1.0 809 3/7/2025
1.0.6 22,988 10/7/2024
1.0.5 7,225 8/6/2024
1.0.4 4,202 6/27/2024
1.0.3 20,585 1/10/2024
1.0.2 345 12/28/2023