如何打开网页视图android的PDF文件? [英] How to open a pdf file in webview android?
本文介绍了如何打开网页视图android的PDF文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经生成使用iText库PDF文件,并获取存储在SD卡。我不得不打开web视图的PDF,但是当我搜索的解决方案,我才知道我可以在网上用谷歌文档服务中打开它,但我的PDF格式存储在SD卡一个。有没有办法在网页视图中打开从外部存储的PDF?
I have generated a pdf using itext library and it gets stored in sdcard. I have to open the pdf in webview , but when I searched for the solution I came to know I can open it using online google doc service ,but my pdf is stored in a sdcard. Is there a way to open a pdf from external storage in a webview?
推荐答案
要在网页视图中打开PDF,它更好地显示通过谷歌文档服务PDF,
To open pdf in Webview , it better to show pdf via google doc service,
WebView webView = (WebView) context.findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.loadUrl("http://docs.google.com/gview?embedded=true&url=http://www.stagecoachbus.com/PdfUploads/Timetable_28768_5.pdf");
这可能会帮助你。
这篇关于如何打开网页视图android的PDF文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文