2

How do I open a PDF file in my web view wihtout downloading and saving it to the SD card? I have done some R&D on this but until now I haven't got any appropriate answers. Can anyone tell me how to use googledoc to open the PDF file in the web view?

Mike T
  • 4,747
  • 4
  • 32
  • 52
Srinivasan
  • 4,481
  • 3
  • 28
  • 36

2 Answers2

6

http://docs.google.com/viewer?embedded=true&url=link_to_pdf will format your PDFs for you to open within the webview, using Google Docs Viewer.

WebView mWebView = new WebView(this);
mWebview.getSettings().setJavaScriptEnabled(true);  
String url = "http://docs.google.com/viewer?embedded=true&url="+"http://sitename.com/xyz.pdf";
mWebview.loadUrl(url); 
Anirudh Ramanathan
  • 46,179
  • 22
  • 132
  • 191
0

See the answer here

mWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+ webUrl);

where webUrl is the url of the pdf you want to open.

Community
  • 1
  • 1
Mike T
  • 4,747
  • 4
  • 32
  • 52