Reputation: 5896
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://officeofthemufti.sg/MaulidBooklet.pdf");
I am using WebView try to loading pdf file, but all I got is empty blank. What is the problem here or I missed something?
Upvotes: 0
Views: 513
Reputation: 8333
Android does not have a PDF viewer, and WebView cannot render PDFs.
you can use the following:
String pdf = "http://officeofthemufti.sg/MaulidBooklet.pdf";
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + pdf);
Upvotes: 1
Reputation: 21567
The webView cannot render pdfs, you need to either launch the pdf in a new intent or use google docs to load the pdf in, ex:
https://docs.google.com/gview?embedded=true&url=http://link.to.your/pdf_file.pdf
Upvotes: 1