You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
<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
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