我的回形针文档在哪里?寻找正确的道路

发布于 2024-09-17 21:49:02 字数 615 浏览 7 评论 0原文

我有一个保存用户文档的网站,我想使用 Paperclip 通过 Google 文档查看器 (https://drive.googleblog.com/2009/09/view-online-files-using-google-docs.html )。

回形针正在工作。例如,我有一个文件保存在: 127.0.0.1:3000/assets/resumes/51/original/myfile.pdf

我想通过我的网站中嵌入的查看器显示该内容。这是我的代码(在 HAML 中):

%iframe{:src=>"http://docs.google.com/viewer?url=http%3A%2F%2F127.0.0.1:3000/#{@user.file.url}&embedded=true"}

问题只是因为我还没有在公共服务器上启动并运行该网站,还是我的代码有问题? (当我将网址直接粘贴到浏览器中而没有查看器内容时,我确实看到了该文件。)

I have a site that saves user documents and I want to use Paperclip to display them using Google Docs Viewer (https://drive.googleblog.com/2009/09/view-online-files-using-google-docs.html).

Paperclip is working. For instance, I have a file saved at:
127.0.0.1:3000/assets/resumes/51/original/myfile.pdf

I want to display that through the viewer embedded in my site. This is my code (in HAML):

%iframe{:src=>"http://docs.google.com/viewer?url=http%3A%2F%2F127.0.0.1:3000/#{@user.file.url}&embedded=true"}

Is the problem just the fact that I haven't got the site up and running on a public server yet, or is something wrong with my code? (When I paste the url straight into my browser without the viewer stuff I do see the file.)

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

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

发布评论

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

评论(1

权谋诡计 2024-09-24 21:49:02

你的假设是正确的。它不起作用,因为您的应用程序不在公共环境中,并且 Google 文档无法通过您的本地主机地址访问您的 PDF。

Your assumption is correct. It is not working because your application is not in a public environment and Google Docs has no way of accessing your PDFs through your localhost address.

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