Paresh Mayani Paresh Mayani - 2 months ago 32
Android Question

Android - Load PDF / PDF Viewer

I want to display pdf contents on webview.

Here is my code:

WebView webview = new WebView(this);
setContentView(webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("URL/Demo_PDF.pdf");


Problem:



When i am trying to run the application, at that time I am getting blank screen.

And also, if there is any PDF viewer then also suggest me !!

FYI, I have already set internet permission.

Answer

Finally, i got a solution, actually i made a trick to load a pdf file using Google Docs inside a webview:

webview.loadUrl("http://docs.google.com/gview?embedded=true&url=http://myurl.com/demo.pdf");