Rails Prawnto PDF 无法在 Internet Explorer 中下载
我有一个有效的 Prawnto 实现,除了 IE 版本 6 - 8 之外。这是我的打印方法:
prawnto :inline => false, :filename => @purchase.deal.name + "-" + @purchase.customer.name+".pdf", :prawn => {:skip_page_creation=>true}
这在 Safari、FF 和 Chrome 上运行良好。你知道,理智的浏览器。
但在IE上,浏览器会尝试下载记录的id号; URL 如下所示:
https://domain.com/customers/print/24? format=pdf
它说“无法下载文件'24'”。
知道我应该在这里做什么吗?
谢谢, 亚伦.
I have a working Prawnto implementation, except for in IE versions 6 - 8. Here's my print method:
prawnto :inline => false, :filename => @purchase.deal.name + "-" + @purchase.customer.name+".pdf", :prawn => {:skip_page_creation=>true}
This works fine on Safari, FF and Chrome. You know, the sane browsers.
But on IE, the browser attempts to download the id number of the record; the URL looks like this:
https://domain.com/customers/print/24?format=pdf
It says "cannot download file '24'".
Any idea what I should be doing here?
Thanks,
Aaron.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在这里更新了我的答案:
Rails PDF Generation with Prawn in IE7
中间件看起来似乎可以工作,但出于某种原因却没有。我们在控制器操作上设置了一些标题,这似乎对我们有用。
I updated my answer over here:
Rails PDF Generation with Prawn in IE7
The middleware thing looked like it would work, but for whatever reason it didn't. We set some headers on the controller action, and that seemed to work for us.
另一个解决方案是创建没有 SSL 要求的 pdf 链接,直到这个问题得到解决。如果您使用 ssl_requirement 插件,请使用 ssl_allowed 而不是 required,然后生成不带 https 的链接。
这不是我想做的,但它暂时完成了工作。我仍在研究这个问题,因为其他发布的解决方案(使用机架中间件拦截标头)对我来说不起作用。
Another solution would be to create pdf link without the SSL requirement until this gets sorted out. If you're using the ssl_requirement plugin, use ssl_allowed instead of required and then generate the link without the https.
It's not what I would like to do, but it gets the job done for now. I'm still looking into this as the other posted solution, to intercept the headers using Rack Middleware, didn't work for me.