Display mauiasset PDF in webview ERR_ACCESS_DENIED.

john murray 1 Reputation point
2023-01-29T11:28:28.2+00:00

I have a VS2022 dotnet prog which runs on IOS and Android

Simple requirement - Open mauiAsset pdf file and display it in webview. 1 page no manipulation simple

Now I know Webview CAN display PDF - I can load it with a pdf on a webserver. How do I open a local file?

The webview is declared in xaml

the code to load the webserved pdf is simple

wv.source = myUri; //works

in the code I test for storage permissions (It is targetting android api 29 at present. The manifest contains copious enablements but still it think the mauiasset is security locked (btw havenet got as far as checking ios)

// check for read permissions 
        PermissionStatus status = await Permissions.CheckStatusAsync<Permissions.StorageRead>();
//status is reported as granted
  var yippee = FileSystem.AppPackageFileExistsAsync(pdfPath).Result;
// but the following gives ERR_ACCESS DENIED
wv.source = pdfPath;

Can anyone suggest how to remove this barrier?

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