Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

why cant show pdf in pdf.js in UWP?

$
0
0

Hi.
I've been using pdf.js and a weibiew render to show a pdf or word file in UWP; in Release and Debug mode if it works, but when I generate the .appxbundle and install the application, I get a damaged Access error when trying to move the file from the local storage to the assets folder of the project.

The code to save the pdf:

// create file in public folder
StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
StorageFile sampleFile = await storageFolder.CreateFileAsync (filename, CreationCollisionOption.ReplaceExisting);

// write sring to created file
await FileIO.WriteBytesAsync (sampleFile, bytes);

// get asets folder
StorageFolder appInstalledFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFolder assetsFolder = await appInstalledFolder.GetFolderAsync ("Assets");

// move file from public folder to assets
await sampleFile.MoveAsync (assetsFolder, filename, NameCollisionOption.ReplaceExisting);
str = sampleFile.Name;

The code for the webview route:

Control.Navigate (new Uri (string.Format ("ms-appx-web: ///Assets/pdfjs/web/viewer.html? File = {0}", string.Format ("ms-appx-web: / // Assets / {0} ", WebUtility.UrlEncode (customWebView.Uri)))));

As I mentioned before, the pdf is seen in release mode and in debugu mode, but when I install the package application it marks me the error of 'access denied'; In the capabilities of my application I have everything that has to do with storage installed in my app. I would like to know how to solve this error.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>