MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Open a local PDF in an UWP application (HoloLens)

Open
#3,724 7 comments 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

bug tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I want to open a PDF file that is stored in the Application.persistentDataPath. This works inside the Unity Editor, but on the HoloLens I see this:

file

public void LoadPdf(string file)
{
  var _webView = GetComponent< WebView >();
   _webView.GetWebViewWhenReady((IWebView webView) =>
  {
      webView.Load(new Uri(FileToUrl(file));
  });
}

 private string FileToUrl(string pdfFile)
            => ("file://" + Application.persistentDataPath + "/" + pdfFile).Replace(" ", "%20"); 

Is there a different way to format the uri to a locally stored PDF or can I somehow change the restrictions of the WebView, to display PDFs from the local file system?

AB#46433231

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.