Patch rendering PDF inline using templates

5 views
Skip to first unread message

javinto

unread,
Dec 30, 2007, 10:37:15 AM12/30/07
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

Reply all
Reply to author
Forward
0 new messages