Rajesh Suthar Rajesh Suthar - 10 months ago 115
Android Question

Load PDF file in webview

I am having webview in my app, i am loading website in my webview and in that website there are multiple links of PDF file but while i am clicking on that it is not opening in webview,
if i am checking it in my windows's browser it opening.
i have enabled javascript but no luck, i used following properties also

webView.setWebViewClient(new myWebClient());

Answer Source

Android does not work like iOS in this respect. The WebView widget cannot display PDF documents on Android.

You will have to:

  • Use a third party library (unfortunately, most open source pdf libs are GPL)

  • Open a pdf viewer app via an Intent

  • Use Google docs in a webview