谷歌文档的PDF阅读器阅读器、文档、PDF

2023-09-13 02:03:26 作者:╰染指青春

在按照很多我想要使用Goolge的文档显示在web视图PDF文件。建议

In accordance with advice of many I'm trying to use goolge docs to show a pdf in a WebView.

下面是我的code:

@SuppressLint("SetJavaScriptEnabled")
public void setDocumentPath(final String path) {
    WebView webView = (WebView) findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setPluginsEnabled(true);
    webView.loadUrl("https://docs.google.com/viewer?url=http://www.selab.isti.cnr.it/ws-mate/example.pdf");
}

PDF格式的只是一些例子,我在网上找到。它工作在我的浏览器,但是在我的Andr​​oid模拟器和设备会显示一个网页不可用。

The PDF is just some example I found online. It works in my browser, but on my android emulator and device it displays a "Webpage not available".

两者都运行Android 4.0。

Both are running android 4.0.

有什么明显的我失踪?谢谢你。

Is there anything obvious I'm missing? Thank you.

推荐答案

而如果有人拍打着自己的头撞墙了类似的情况,这是被遗忘的权限的情况下。

And in case someone is beating their head against the wall in a similar situation, it's a case of forgotten permissions.

<uses-permission android:name="android.permission.INTERNET" />