GithubHelp home page GithubHelp logo

Comments (4)

michaelfarnsworth avatar michaelfarnsworth commented on September 3, 2024 1

@victorhuangwq if you are attempting to load the PDF from an arbitrary local on the device's file system, you just run into an error. As this could be a security issue. If you wish to load a PDF from the device, you should be able to leverage the SetVirtualHostMapping() method, mention here.

You'll just need to ensure that the PDF is deployed as an asset/resource with your APPX, with the correct relative path.

from webview2samples.

rgolomidov avatar rgolomidov commented on September 3, 2024

Thank you, the error no longer appears, but now the application crashes every time. I will try to get this under control.
The PDF file is on a server and is downloaded at runtime and stored in the ApplicationDataPath, from where it is then accessed via WebView.

from webview2samples.

rgolomidov avatar rgolomidov commented on September 3, 2024

it work now! The SetVirtualHostMapping() is the way to go

from webview2samples.

LordKrampus avatar LordKrampus commented on September 3, 2024

Some example of how that worked for me

((IWithVirtualHost)webView).SetVirtualHostMapping("webview2.sample", Application.dataPath + "/StreamingAssets/"); webViewComponent.Load(new Uri($"http://webview2.sample/{this.fileName}"));

Actually, if some trouble in path string, Unity crashes and shutdown (nothing about raising errors, exceptions, or Bug console for Unity).

from webview2samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.