I want to display pdf contents on webview.

Here is my code:

WebView webview = new WebView(this); 


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.

Solution 1

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


Solution 2

I'm sorry but WebView does not display PDF content.
What you might want is a PDF viewer that responds to the PDF MIME type.

Here are a couple of free open-source libraries you might want to check:

Solution 3

You can try using mupdf (www.mupdf.com) You can build a native code library (libmupdf.so) to be loaded onto your android project using the ndk. This would ensure a lot faster rendering of pdf files... check out the project at : http://mupdf.com/repos/mupdf/android/

Solution 4

WebView does not have a PDF plugin. You should store the PDF locally and open an intent for viewing that kind of content.