Sha256: 508b398de4dca67d1d31a4adfa6711c23de8b513e676abcff0e68f1c8f2b3722

Contents?: true

Size: 708 Bytes

Versions: 8

Compression:

Stored size: 708 Bytes

Contents

module Mack
  module Rendering # :nodoc:
    module Engine # :nodoc:
      class Pdf < Mack::Rendering::Engine::Base

        def render(io, binding)
          if io.is_a?(File)
            io = io.read
          end
          @_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.instance.register(:action, :pdf)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mack-pdf_writer-0.8.2 lib/mack-pdf_writer/pdf_engine.rb
mack-pdf_writer-0.8.3 lib/mack-pdf_writer/pdf_engine.rb
mack-pdf_writer-0.8.3.1 lib/mack-pdf_writer/pdf_engine.rb
mack-pdf_writer-0.8.0 lib/mack-pdf_writer/pdf_engine.rb
mack-pdf_writer-0.8.0.1 lib/mack-pdf_writer/pdf_engine.rb
mack-pdf_writer-0.8.0.101 lib/mack-pdf_writer/pdf_engine.rb
mack-pdf_writer-0.8.0.2 lib/mack-pdf_writer/pdf_engine.rb
mack-pdf_writer-0.8.1 lib/mack-pdf_writer/pdf_engine.rb