是否可以在 Google 文档请求中包含 http 标头?

发布于 2024-10-31 23:15:47 字数 257 浏览 0 评论 0原文

我正在开发一个 Adnroid 应用程序,需要读取远程 pdf 文件并打开它,我看到 google docs 可以使用以下网址从 pdf 进行转换:

http://docs.google.com/viewer?url=

我遇到的问题是,我检索文件的 url 需要将标头添加到 http要求。有谁知道如何将其添加到对谷歌文档的调用中?

I am working on an Adnroid app that needs to read a remote pdf file and open it, I saw that google docs can do the conversion from pdf, using this url:

http://docs.google.com/viewer?url=

The problem I have is that my url to retrieve the file requires a header to be added to the http request. Does anyone have a hint as to how this could be added to the call to google docs?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

拧巴小姐 2024-11-07 23:15:47

我没有完全理解你的问题,但这是我在网络视图中加载pdf时所做的相同的事情: Android - 加载PDF/PDF查看器,它可能会帮助你。

根据您下面的评论,我可以建议您考虑一种情况:

1. 
 if(network is available)
    {
   //    load pdf in google docs.
    } 
2. 

if(network is not available)
{
 //load pdf in third party application which is already been installed in your phone.
}
else 
{
//Give Alert message that you cant view pdf this time. or whatever message you want to display.

}

给出错误消息

I didnt get your problem exactly what you means to say , but here is the same thing i have done to load pdf inside a webview: Android - Load PDF / PDF Viewer, it may help you.

From your comment below, i can suggest you to think one scenario:

1. 
 if(network is available)
    {
   //    load pdf in google docs.
    } 
2. 

if(network is not available)
{
 //load pdf in third party application which is already been installed in your phone.
}
else 
{
//Give Alert message that you cant view pdf this time. or whatever message you want to display.

}

Give error message

过潦 2024-11-07 23:15:47

秘密是HttpClient

查看此示例在 cookies 上 - 它与标头不同,但可以使用同一个对象来设置它们。这是一段非常好的代码。

谷歌一下,如果你有更多问题 - 一旦你知道该使用什么,我发现很容易查找我需要的具体信息。

The secret is HttpClient.

Check out this example on cookies - it's different from headers, but the same object can be used to set them both. It's a pretty good chunk of code.

Google around, if you've got more questions - once you know what to use, I found it easy to look up the specifics I needed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文