0

My application has one button. If you click that button then it will display the web pages based on the web service response using webview.

It works properly for general links. But for links that have .pdf, a white screen gets displayed.

Is it possible to display the .pdf file using web view?

Would appreciate any help.

i used the following code

WebSettings webSettings = mWebView.getSettings();   
webSettings.setJavaScriptEnabled(true);

mWebView.loadUrl("http://docs.google.com/gview?embedded=true&url="
                +"http://www.kim-lai.com/images/Menu_100309.pdf");
naresh
  • 10,332
  • 25
  • 81
  • 124

2 Answers2

1

It sounds like it could be trying to but there is no direct pdf rendering support in webview. Please look at the following question

android webview pdf

You may find the following question useful also

how to open a pdf file inside a webview for android?

EDIT

Android - Load PDF / PDF Viewer

Please also make sure you ask appropriate questions, prefrerably with code so that others can reproduce your problem and offer a solution. Do your own research!!! Stack overflow is not a magic site that does your work for you!!!

ADENDUM

You require internet permissions. Add this to your manifest.xml

SUPPLEMENTAL

I tried typing in the url into the browser and it tells me "Sorry, we are unable to retrieve the document for viewing or you don't have permission to view the document. "

Community
  • 1
  • 1
Moog
  • 10,193
  • 2
  • 40
  • 66
  • His question is well asked. He made assumptions then asked if something from the assumption can be the problem. Question doesnt mean always needs to contain code. – Nikola Despotoski Jul 25 '11 at 12:56
  • 1
    @Nikola I have adjusted my answer accordingly, the problem was more to do with a distinct lack of research. – Moog Jul 25 '11 at 13:03
  • i am trying with android webview pdf but it not works properly(it shows just loading only). i added code also. please refer. – naresh Jul 25 '11 at 13:05
  • @Merlin Research is something that everyone has as an issue on SO :P Cheers – Nikola Despotoski Jul 25 '11 at 13:06
  • Please read the answer I provided. The only known solution is to hack it by changing the url to googledocs. – Moog Jul 25 '11 at 13:12
  • is any permission are required for this like internet. – naresh Jul 25 '11 at 13:20
  • @Nikola please do not make excuses for people who expect others to do their work for them, it takes 2 seconds to google for an answer, it takes much longer for me to reply, correct formatting, etc. – Moog Jul 25 '11 at 13:20
  • @naresh Yes I have updated my response. Accept if this answers your question – Moog Jul 25 '11 at 13:22
  • i added internet permission also but still it not working. It shows Loading only. – naresh Jul 25 '11 at 13:26
  • try typing the address into the browser on your pc and see what happens – Moog Jul 25 '11 at 13:27
  • It displaying like this in the emulator Loading..... please once again check it the url on the browser see what happens – naresh Jul 25 '11 at 13:52
0
mWebView.loadUrl("http://www.kimlai.com/images/Menu_100309.pdf"); 

Try like this, what do you see?

Nikola Despotoski
  • 49,966
  • 15
  • 119
  • 148