Skip to content

vitalii-vov/Maui.PDFView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maui.PDFView

Library for display PDF files in .NET MAUI on Android and iOS (Windows alpha)

maui-pdfview-480.mp4

.NET 8.0 .NET MAUI

Platform Supported
Android
iOS
Windows alpha

Installation

Install-Package Vitvov.Maui.PDFView

Usage

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .UseMauiPdfView()   // <- Write this
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
            });
        return builder.Build();
    }
}
<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">

    <!--
    IsHorizontal — Display PDF horizontally
    Uri — Path to the file on the device
    -->
    <pdf:PdfView
        IsHorizontal="{Binding IsHorizontal}"
        Uri="{Binding PdfSource}" />

</ContentPage>
internal partial class MainPageViewModel : ObservableObject
{
    [ObservableProperty] private string _pdfSource;

    [RelayCommand] private void ChangeUri()
    {
        PdfSource = "/path/to/file.pdf";
    }
}

About

This repository contains a control for .NET MAUI and allows you to display PDF in View

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages