tuarua / WebViewANE

WebView Adobe Air Native Extension for macOS 10.10+, Windows Desktop, iOS 9.0+ and Android 19+. This ANE provides access to a more modern webview from AIR.
Apache License 2.0
183 stars 53 forks source link

Load a PDF #158

Closed coxfrederic closed 6 years ago

coxfrederic commented 6 years ago

Answer the below. DO NOT DELETE!!

Yes

1.5.0

OSX

Flash Builder

20

I searched the docs and issues in Github but can't find an answer.

Is it possible to load a PDF from local disk? pathFile.nativePath points to a PDF that is being loaded but not displayed it seems.

I use

webView = new WebViewANE; var settings:Settings = new Settings; settings.webkit.plugInsEnabled = true; var thisL:Point = new Point(0,0); var thisG:Point = localToGlobal(thisL); var webViewViewport:Rectangle = new Rectangle(thisG.x + 10, thisG.y + 10, this.width - 45, this.height - 20); webView.init(stage, webViewViewport, "", null, 1, 0xFFFFFF, true); webView.loadFileURL(pathFile.nativePath, File.applicationStorageDirectory.nativePath);

Is this not supported or am I using it wrong?

A PDF to be displayed, I'm not seeing the PDF

Not relevant

tuarua commented 6 years ago

It is possible. It should be loaded from applicationDirectory or applicationStorageDirectory (whichever allowingReadAccessTo param is set to). Here I've loaded the air release notes from a local fie.

image

coxfrederic commented 6 years ago

Do you have Acrobat DC installed? For me it is not working if I do it like this:

`webView = new WebViewANE;

var settings:Settings = new Settings;

                var thisL:Point = new Point(0,0);

                var thisG:Point = localToGlobal(thisL);

                var webViewViewport:Rectangle = new Rectangle(thisG.x + 10, thisG.y + 10, this.width - 45, this.height - 20);

                webView.init(stage, webViewViewport, "", null, 1, 0xFFFFFF, true);

                webView.loadFileURL(pathFile.nativePath, File.applicationStorageDirectory.nativePath);`
coxfrederic commented 6 years ago

I found a workaround by upgrading to 1.6.5 and then using PDF.js viewer together with https://github.com/tuarua/WebViewANE/issues/150

So I have a solution but unclear why the code is not working directly to the PDF.