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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to