简体   繁体   English

如何从 URL 加载 webView 中的 PDF?

[英]How to load PDF in webView from URL?

I am creating and Android app that fetches file url from Parse server and displays the PDF in webView with the help of Google preview, directly loading the PDF into the webView takes forever to load. I am creating and Android app that fetches file url from Parse server and displays the PDF in webView with the help of Google preview, directly loading the PDF into the webView takes forever to load.

But the problem here is Google has a limit of 25mb ie files larger than 25mb cannot be previewed and it gives a message "Whoops file size too large"但这里的问题是谷歌有 25mb 的限制,即无法预览大于 25mb 的文件,并给出一条消息“哎呀文件大小太大”

With Google previewer this is how the url looks:使用 Google 预览器,url 的外观如下:

https://docs.google.com/viewer?url=http://my.domain.com/yourPdfUrlHere.pdf https://docs.google.com/viewer?url=http://my.domain.com/yourPdfUrlHere.pdf

Is there any way to load PDF from URL and also displaying what has already loaded so that the users don't have to wait forever?有什么方法可以从 URL 加载 PDF 并显示已经加载的内容,以便用户不必永远等待?

Thanks in advance..提前致谢..

webView.loadUrl("http://docs.google.com/gview?embedded=true&url=" + url);

This will concatenate your URL with Google Docs PDF Viewer and load it.这会将您的 URL 与 Google Docs PDF 查看器连接并加载它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM