How to view the pdf file from MAUI?

Sowndarrajan Vijayaragavan 330 Reputation points
2023-06-18T15:25:30.0433333+00:00

I need to view the pdf file in my MAUI application.

Dedicated popup page to view my pdf file with Zoom, pan controls

Target platform - Windows

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,905 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 68,661 Reputation points Microsoft Vendor
    2023-06-19T03:00:39.3433333+00:00

    Hello,

    You can use webview to show the pdf file.

    Firstly, you can copy pdf file to Resources\Raw\ path and make sure pdf file's Build action is MauiAsset

    Then, you can use the following code to show your pdf file.

    <?xml version="1.0" encoding="utf-8" ?>
    <toolkit:Popup  xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                   xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
                 x:Class="MauiShowPDF.SimplePopup"
                 >
    
           <Grid >
                
                <WebView Grid.Row="1" HorizontalOptions="Fill" VerticalOptions="Fill" Source="maui.pdf" />
            </Grid>
                
    </toolkit:Popup>
    

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. winironteam 6 Reputation points
    2023-10-23T04:17:01.0066667+00:00

    Hi

    IronPdf offers a PDF viewer solution in MAUI. To use it, install IronPdf.Viewer.Maui from NuGet, in addition to the main IronPdf package. For more information, follow the tutorial at https://ironpdf.com/tutorials/pdf-viewing/

    0 comments No comments