SfPdfViewer2 does not work on .NET MAUI Blazor Hybrid & Web App

Hi, I have this code and it works perfectly with my Blazor Web App but for my .NET MAUI Hybrid App it does not work, how can I solve this? This app crashes immediately the SfPdfViewer2 component is rendered when driver.UploadedLicense == UploadedLicense.Yes

@if (driver.UploadedLicense == UploadedLicense.Yes)

{

    // pdf viewer

    List<Syncfusion.Blazor.SfPdfViewer.ToolbarItem> ToolbarItems = new List<Syncfusion.Blazor.SfPdfViewer.ToolbarItem>()

{

Syncfusion.Blazor.SfPdfViewer.ToolbarItem.PageNavigationTool,

Syncfusion.Blazor.SfPdfViewer.ToolbarItem.MagnificationTool,

Syncfusion.Blazor.SfPdfViewer.ToolbarItem.SelectionTool,

Syncfusion.Blazor.SfPdfViewer.ToolbarItem.PanTool,

Syncfusion.Blazor.SfPdfViewer.ToolbarItem.UndoRedoTool,

Syncfusion.Blazor.SfPdfViewer.ToolbarItem.CommentTool,

Syncfusion.Blazor.SfPdfViewer.ToolbarItem.SearchOption,

Syncfusion.Blazor.SfPdfViewer.ToolbarItem.PrintOption,

Syncfusion.Blazor.SfPdfViewer.ToolbarItem.DownloadOption

};


    <!-- View Doc -->

    <RadzenButton Click="@((args) => {ViewLicenseFile();})" Variant="Radzen.Variant.Filled" Shade="Shade.Dark" Icon="fit_screen" Text="View License" ButtonStyle="ButtonStyle.Dark" />


    <div style="visibility: @IsLoaded; height: @DocumentHeight; width: @DocumentWidth; margin-bottom: @MarginBottom; padding: 5px; border-width: 0.01px; border-radius: 10px; border-color: lightgray;">

        <SfPdfViewer2 @ref="viewer" Height="100%" Width="100%">

            <PdfViewerToolbarSettings ToolbarItems="@ToolbarItems"></PdfViewerToolbarSettings>

        </SfPdfViewer2>

        <!--Close | Delete-->

        <RadzenStack Orientation="Radzen.Orientation.Horizontal" JustifyContent="JustifyContent.Center" class="mt-3 mb-2">

            <RadzenButton Click="@((args) => { CollapseViewer(); })" Variant="Radzen.Variant.Outlined" Shade="Shade.Darker" Icon="close_fullscreen" Text="Collapse Doc" ButtonStyle="ButtonStyle.Info" />

            <RadzenButton Click="@((args) => { RemoveFileDialogVisibility = true; })" Variant="Radzen.Variant.Outlined" Shade="Shade.Dark" Icon="delete" Text="Delete Doc" ButtonStyle="ButtonStyle.Danger" />

        </RadzenStack>

    </div>

}


Attachment: DriversDataGrid_7636ab1.zip

3 Replies

VS Venkada Subramanian Durai Syncfusion Team October 13, 2025 04:45 PM UTC

Hi À la mode Clothing Outlet,


Thank you for the update. We were unable to replicate the reported issue using the provided code, as it appears to be missing some dependencies. To assist further, could you please modify the attached project to ensure the issue can be reproduced? This will help us accurately identify the problem and provide a suitable solution.

 

Additionally, please share any error details you encountered, as they will be helpful in reproducing the issue. Also, kindly confirm whether the MAUI Blazor sample was created using the steps outlined in the Getting Started guide. Missing any of these steps could potentially lead to the issue you're experiencing.

 

Please feel free to reach out if you have any questions or need further assistance.

 

Getting Started with MAUI Blazor PDF Viewer


Regards,
Venkada Subramanian D


Attachment: MAUIBlazor_51ac8e68.zip


ÀL À la mode Clothing Outlet October 14, 2025 08:27 PM UTC

Hi, i figured it out. I was missing this line in my MauiProgram.cs file: 

builder.Services.AddMemoryCache();

I added this line and now everything works perfectly. Thank you so much!



VS Venkada Subramanian Durai Syncfusion Team October 15, 2025 04:05 AM UTC

Hi À la mode Clothing Outlet,

Thanks for the update. Please ping us if you need any assistance or have any additional requirements.


Regards,
Venkada Subramanian D


Loader.
Up arrow icon