gpt4 book ai didi

Android WebView 显示 html 而不是 pdf 或文档

转载 作者:行者123 更新时间:2023-11-30 03:21:12 25 4
gpt4 key购买 nike

我有一个启用了 javascript 的 WebView ,我正在尝试显示 pdf、文档等...使用 google 文档 View url。问题是 webview 呈现的是 html 而不是 doc。我应该提一下,这也会发生在我的保管箱帐户中的 pdf 或文档的 url 上。

string pdf = "https://docs.google.com/document/d/1SGFAxaYSA2wBvKCKL89rYG4yEZIJVIJ2lY-1G7IF6g4/edit?usp=sharing";
webViewcontent.LoadUrl("https://docs.google.com/gview?embedded=true&url=" + pdf);

这是显示的内容: enter image description here

最佳答案

我认为您要查找的网址是...

 string url = "https://docs.google.com/document/d/1SGFAxaYSA2wBvKCKL89rYG4yEZIJVIJ2lY-1G7IF6g4/edit?usp=sharing";
string myUrl = string.Format("https://docs.google.com/viewer?url={0}", url);
webViewcontent.LoadUrl(myUrl);

这将在用户没有谷歌帐户的情况下工作。

但是,由于您的网址使用的是 https,因此可能需要身份验证。

关于Android WebView 显示 html 而不是 pdf 或文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19106038/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com