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");
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.
To fix a PDF file not opening in Adobe reader, you will need to download the latest version of Adobe Reader. After which you will disable the protected mode that comes with it by default. Once this is changed, the issue of the PDF file not opening in Adobe reader will be resolved.
Android has a built in framework from Android 5.0 / Lollipop, it's called PDFRenderer.
The very first and the easiest way of displaying the PDF file is to display it in the WebView. All you need to do is just put WebView in your layout and load the desired URL by using the webView. loadUrl() function. Now, run the application on your mobile phone and the PDF will be displayed on the screen.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With