I can create and save a pdf file with:

pdf = PDF::Writer.new()
pdf.select_font "Times-Roman"
pdf.text "Sample PDF Document", :font_size => 32, :justification =>
:center
pdf.save_as("pdffilename.pdf")

but I'd like to re-use rpdf template, i I use the following code:


pdf_content = render_to_string(:template =>
"documents/#{template}-#{kind}", :layout => false)
set_no_cache_headers
send_data(pdf_content, :filename => "#{@document.name_for_file}.pdf",
:type => 'application/pdf', :status => 200)

I have the error "Can only render or redirect once per action".
How can I save pdf to server disk without render twice ?

thanks
kind regards,
Enrico.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 5, '12 at 2:18p
activeJan 5, '12 at 2:18p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Enrico M.: 1 post

People

Translate

site design / logo © 2021 Grokbase