Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

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

License

NotificationsYou must be signed in to change notification settings

vitalii-vov/Maui.PDFView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

NuGet DownloadsGitHub Licenselast commit

.NET 8.0.NET MAUI
PlatformAndroidiOSMacOSWindows
Supported
maui-pdfview-480.mp4

 

Installation

Install-Package Vitvov.Maui.PDFView

 

Usage

 
Add.UseMauiPdfView() to MauiProgram

publicstaticclassMauiProgram{publicstaticMauiAppCreateMauiApp(){varbuilder=MauiApp.CreateBuilder();builder.UseMauiApp<App>().UseMauiPdfView();// <- Write thisreturnbuilder.Build();}}

 
AddPdfView to XAML

<ContentPagex: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    MaxZoom — max zoom level    PageChangedCommand — event of changing the current page-->    <pdf:PdfViewIsHorizontal="{Binding IsHorizontal}"Uri="{Binding PdfSource}"MaxZoom="4"PageChangedCommand="{Binding PageChangedCommand}">    </pdf:PdfView></ContentPage>

Important

To use a component with.net9 addHandlerProperties.DisconnectPolicy="Manual" toPdfView

<pdf:PdfView    HandlerProperties.DisconnectPolicy="Manual" />

 
SetPdfSource in ViewModel

internalpartialclassMainPageViewModel:ObservableObject{[ObservableProperty]privatestring_pdfSource;[RelayCommand]privatevoidChangeUri(){try{//  See the example project to understand how to work with paths.PdfSource="/path/to/file.pdf";}catch(Exceptionex){// handle exceptions}}}

 

Personalization

You can customize the way pages are displayed by modifying thePageAppearance property in thePdfView component.

<pdf:PdfViewUri="{Binding PdfSource}"><!--    Margin — Adds indents around pages    ShadowEnabled — Adds a shadow to each page    Crop — crops out the part around the page-->    <pdf:PdfView.PageAppearance>        <pdf:PageAppearanceMargin="16,8"ShadowEnabled="True"Crop="64,32"/>    </pdf:PdfView.PageAppearance></pdf:PdfView>

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


[8]ページ先頭

©2009-2025 Movatter.jp