Android的 - PDF链接问题 [英] android - Pdf link problem

查看:158
本文介绍了Android的 - PDF链接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序有一个按钮。如果您单击该按钮,然后将显示基于使用的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渲染网页视图支持。请看以下问题

的Andr​​oid的WebView PDF

您可能会发现以下问题也非常有用

如何打开PDF文件为Android网页视图里面呢?

修改

Android的 - 加载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

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. "

这篇关于Android的 - PDF链接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆