开发者

can we render pdf on web view in android

开发者 https://www.devze.com 2023-03-01 01:17 出处:网络
can we render pdf and show it on web view in androi开发者_开发问答d. kindly help me outYes you can load PDF in Webview using Google\'s gview, It is a trick.

can we render pdf and show it on web view in androi开发者_开发问答d. kindly help me out


Yes you can load PDF in Webview using Google's gview, It is a trick.

Here you can have my solution for the same trick: Android - Load PDF / PDF Viewer.


You cant open PDF file directly in android web browser but using Google Docs Viewer. you can open it in android Browser like:

String webUrl="http://myweb.com/demo.pdf";
mWebView.loadUrl("https://docs.google.com/gview?embedded=true&url="+ webUrl);


Unluckily, Google has changed the api... When you try to load the docs.google.com/gview url, the web view is redirect to the new drive.google.com/viewerng that can't render the pdf in the Android WebView...

Any other clever solution? :D

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号