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 webv
Solution 1:
Android does not work like iOS in this respect. The WebView widget cannot display PDF documents on Android.
You will have to:
Solution 2:
this may help you,
StringmyPdfUrl="http://example.com/awesome.pdf";
Stringurl="http://docs.google.com/gview?embedded=true&url=" + myPdfUrl;
Log.i(TAG, "Opening PDF: " + url);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);
Solution 3:
Whenever you want to open pdf saved in google drive this code can be used
WebView view=(WebView)findViewById(R.id.webView);
view.setWebViewClient(newWebViewClient());
String url=getIntent().toString("value1");
StringURL="https://docs.google.com/viewer?url="+url;
view.loadUrl(Url);
Post a Comment for "Load Pdf File In Webview"