用户成功生成 pdf 中的 1 页后,PDFKit 在 Rails 3 应用程序中将所有页面渲染为 pdf
我想生成 pdf 格式的一些页面,所以我开始使用 PDFKit gem。
一切正常,但是,当用户下载 pdf 格式的页面时,此后用户单击的任何链接都会下载为 pdf!我希望只打开一页的 pdf 生成功能。
我的配置是:
application.html.erb
<%= stylesheet_link_tag "application", :media => 'all'%>
application.rb
config.middleware.use "PDFKit::Middleware", :print_media_type => true
show.html.erb
<td><%= link_to "PDF", medicalhistory_path(medicalhistory, :format => "pdf")%></td>
I want to generate some pages in pdf and so I started with PDFKit gem.
Everything works fine, however, when the user downloads a page in pdf, after that point on any link that the user clicks is getting downloaded to pdf!!. I wish to have the pdf generation turned on only one page.
My configurations are:
application.html.erb
<%= stylesheet_link_tag "application", :media => 'all'%>
application.rb
config.middleware.use "PDFKit::Middleware", :print_media_type => true
show.html.erb
<td><%= link_to "PDF", medicalhistory_path(medicalhistory, :format => "pdf")%></td>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
回滚到 0.4.6
https://github.com/jdpace/PDFKit/issues/66
rolled back to 0.4.6
https://github.com/jdpace/PDFKit/issues/66
我在 pdfkit gem 版本 0.5.0 中也遇到了同样的问题,如果我删除 config.middleware.use PDFKit::Middleware 它工作正常。
I was also getting the same problem with pdfkit gem version 0.5.0, if I remove the config.middleware.use PDFKit::Middleware it is working fine.