开发者

How to save the prawn pdf on rails root without rendering

开发者 https://www.devze.com 2023-04-08 17:30 出处:网络
Here my code rendering pdf is ok .But I don\'t want render directly save to the rails folder how? Help me please

Here my code rendering pdf is ok .But I don't want render directly save to the rails folder how?

Help me please

respond_to do |format|
  format.html   # show.html.erb
  format.xml    { render :xml =>开发者_如何学JAVA @claim }
  format.report { render_report }
  format.xls    { render_report }
  format.pdf    { render :layout => false }
end


I'm not sure if I understood well... if you want to have downloadable pdf, you could do something like this:

format.pdf {send_data your_pdf, :type => 'application/pdf'}

You didn't say which version of rails are you using, but in general methods send_data and send_file could be usefull for you (links are to v 2.3.8, but of course those methods exist in newer versions).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号