Android的 - PDF链接问题 [英] android - Pdf link problem
问题描述
我的应用程序有一个按钮。如果您单击该按钮,然后将显示基于使用的WebView Web服务响应的网页。
能正常工作,一般的链接。但对于那些有 .PDF
链接,一个白色的屏幕获取显示。
是否可以使用Web视图中显示.pdf文件?
请问AP preciate任何帮助。
我用下面的code
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(真);mWebView.loadUrl(http://docs.google.com/gview?embedded=true&url=
+http://www.kim-lai.com/images/Menu_100309.pdf);
这听起来像它可能会尝试,但没有直接的PDF渲染网页视图支持。请看以下问题
您可能会发现以下问题也非常有用
的修改的
也请确保您问合适的问题,$ P与code $ pfrerably,让其他人可以重现你的问题,并提供解决方案。做自己的研究!堆栈溢出不是一个神奇的网站,做你的工作给你!
的 ADENDUM 的
您需要网络权限。添加到您的manifest.xml
的补充的
我试着键入网址到浏览器,它告诉我:对不起,我们无法检索查看文档,或者您没有权限查看文档。
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");
It sounds like it could be trying to but there is no direct pdf rendering support in webview. Please look at the following question
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. "
这篇关于Android的 - PDF链接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!