Sha256: 75c975e241aea0bcd3a21dd8b84f652ce9a80a4221b598e26145d1e713fbb2c0

Contents?: true

Size: 835 Bytes

Versions: 1

Compression:

Stored size: 835 Bytes

Contents

module Prawn
  class Document
    module Internals
      delegate [:open_graphics_state] => :renderer

      # wraps existing content streams with two new streams
      # containing just 'q' and 'Q'. This ensures that prawn
      # has a pristine graphics context before it starts adding content.
      #
      # adds a new, empty content stream to each page. Used in templating so
      # that imported content streams can be left pristine
      #
      def fresh_content_streams(options = {})
        (1..page_count).each do |i|
          go_to_page i

          state.page.wrap_graphics_state
          state.page.new_content_stream
          apply_margin_options(options)
          generate_margin_box
          use_graphic_settings(options[:template])
          forget_text_rendering_mode!
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prawn-templates-0.1.2 lib/prawn/document/internals.rb