Reputation: 107
How can i display docx and pdf file in WebView not using url?
Any idea to read document file in android?
Upvotes: 0
Views: 1785
Reputation: 76
try this,
WebView webview = new WebView(this);
setContentView(webview);
String myPdfUrl = "http://example.com/awesome.pdf";
String url = "http://docs.google.com/gview?embedded=true&url=" + myPdfUrl;
Log.i(TAG, "Opening PDF: " + url);
webview.getSettings().setPluginsEnabled(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);
Upvotes: 1