Skip to content

Instantly share code, notes, and snippets.

@treybean
Created August 12, 2010 22:22
Show Gist options
  • Save treybean/521873 to your computer and use it in GitHub Desktop.
Save treybean/521873 to your computer and use it in GitHub Desktop.
Prawn Handler for Rails 3
# in config/initializers
module ActionView
module Template::Handlers
class Prawn < Template::Handler
include ActionView::Template::Handlers::Compilable
self.default_format = Mime::PDF
def compile(template)
"pdf = Prawn::Document.new; #{template.source}; pdf.render;"
end
end
end
end
ActionView::Template.register_template_handler(:prawn, ActionView::Template::Handlers::Prawn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment