Reputation: 1441
i am using prawn gem to generate pdf file,
pdf.render_file('csv.pdf') is saving the file to the project root
instead i want to open the pdf before saving to root, then save it to any location
how to go about it??
thanks
Upvotes: 0
Views: 930
Reputation: 7188
Try in the controller:
respond_to do |format|
format.pdf do
`send_data your_pdf.render, :filename=>"default_filename.pdf", :type=>"application/pdf"`
end
end
where your_pdf
is the object you created with Prawn.
Upvotes: 4