Render PDF from internal storage in UWP

I need to open a pdf file stored in the internal storage of windows phone.

First of all, I download the pdfs files with HttpClient client and store it in the LocalFolder:

        client.GetAsync(linkPDF).ContinueWith((requestTask) =>
        {
            HttpResponseMessage response = requestTask.Result;

            response.EnsureSuccessStatusCode();

            var bytes = response.Content.ReadAsByteArrayAsync().Result;
            var path = ApplicationData.Current.LocalFolder.Path;
            string localPathCatalogo = Path.Combine(path, filename);
            Debug.WriteLine(localPath);
            File.WriteAllBytes(localPath, bytes);

        });

and then throughout a xamarin webview (https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/controls/display-pdf/) I want to render it.

If I store the pdf in Assets folder I can render it with no problem:
Control.Source = new Uri(string.Format("ms-appx-web:///Assets/pdfjs/web/viewer.html?file={0}", new Uri("ms-appx-web:///Assets/file.pdf")));

but don't in local:
Control.Source = new Uri(string.Format("ms-appx-web:///Assets/pdfjs/web/viewer.html?file={0}", new Uri("ms-appx-web:///local/anotherfile.pdf")));

has someone any idea about why I can't render it?

I've try put different paths but without success.

Thanks in advance!

Answers

Sign In or Register to comment.