javinto
unread,Dec 30, 2007, 10:37:15 AM12/30/07Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: RFPDF
Hi,
I found out that when rendering a PDF with the rails templates it will
never be rendered inline within a new window. As a consequence a the
pdf-file will be downloaded as a file.
Using send_data pdf.Output, :filename => "something.pdf", :type =>
"application/pdf", :disposition => 'inline' however it does open a new
window and renders inline.
The problem here is with the RFpdfView.render method where there is a
typo. I made a patch as follows:
--- view.rb (revision 69)
+++ view.rb (working copy)
@@ -51,7 +51,7 @@
unless @action_view.controller.headers["Content-Type"] ==
'application/pdf'
@generate = true
@action_view.controller.headers["Content-Type"] = 'application/
pdf'
- @action_view.controller.headers["Content-disposition:"] =
"inline; filename=\"#{@options[:file_name]}\""
+ @action_view.controller.headers["Content-disposition"] = "inline;
filename=\"#{@options[:file_name]}\""
end
assigns = @action_view.assigns.dup