Skip to content

Instantly share code, notes, and snippets.

@markbates
Created August 25, 2008 02:39
Show Gist options
  • Select an option

  • Save markbates/7024 to your computer and use it in GitHub Desktop.

Select an option

Save markbates/7024 to your computer and use it in GitHub Desktop.
module Mack
module Rendering
module Engine
class Pdf < Mack::Rendering::Engine::Base
def render(io, binding)
@_pdf = ::PDF::Writer.new
self.view_template.instance_variable_set("@_pdf", @_pdf)
eval(io, binding)
@_pdf.render
end
def extension
:pdfw
end
module ViewHelpers
def pdf
@_pdf
end
end
end
end
end
end
Mack::Rendering::ViewTemplate.send(:include, Mack::Rendering::Engine::Pdf::ViewHelpers)
Mack::Rendering::Engine::Registry.register(:action, :pdf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment