Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
12 lines (11 sloc) 381 Bytes
module PdfRenderer
require "action_controller"
Mime::Type.register "application/pdf", :pdf
require "prawn"
ActionController::Renderers.add :pdf do |filename, options|
pdf = Prawn::Document.new
pdf.text render_to_string(options)
send_data(pdf.render, :filename => "#{filename}.pdf",
:type => "application/pdf", :disposition => "attachment")
end
end
Something went wrong with that request. Please try again.