Android - 加载 PDF/PDF 查看器 [英] Android - Load PDF / PDF Viewer
本文介绍了Android - 加载 PDF/PDF 查看器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 webview 上显示 pdf 内容.
I want to display pdf contents on webview.
这是我的代码:
WebView webview = new WebView(this);
setContentView(webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("URL/Demo_PDF.pdf");
问题:
当我尝试运行该应用程序时,我的屏幕出现空白.
Problem:
When i am trying to run the application, at that time I am getting blank screen.
此外,如果有任何 PDF 查看器,也请推荐我!!
And also, if there is any PDF viewer then also suggest me !!
仅供参考,我已经设置了互联网权限.
FYI, I have already set internet permission.
推荐答案
最后,我得到了一个解决方案,实际上我做了一个技巧来在 webview 中使用 Google Docs 加载 pdf 文件:
Finally, i got a solution, actually i made a trick to load a pdf file using Google Docs inside a webview:
webview.loadUrl("http://docs.google.com/gview?embedded=true&url=http://myurl.com/demo.pdf");
这篇关于Android - 加载 PDF/PDF 查看器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文