Sha256: 9f42392c37f76943e8225bf61c8775de91ba1578d35d688bd75f9bc0dd4802d8

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

require 'prawn-rails/document'

module PrawnRails
  module RailsHelper

    def prawn_document(options={})
      options.reverse_merge!({
        page_layout: PrawnRails.config.page_layout,
        page_size: PrawnRails.config.page_size,
        info: {
          Title: @filename.sub(/\.(p|P)(d|D)(f|F)$/, '')
        }
      })

      if PrawnRails.config.skip_page_creation
        options.reverse_merge!(skip_page_creation: true) 
      end

      pdf = PrawnRails::Document.new(options)

      yield pdf if block_given?

      pdf.render
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prawn-rails-1.2.0 lib/prawn-rails/rails_helper.rb
prawn-rails-1.1.0 lib/prawn-rails/rails_helper.rb