Sha256: 5ebc31ed41cd9a99069cd2491c5dc50e8ae1a3f0000c149b85ad546a300e6900

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

module PDF
  module Core
    class DocumentState #:nodoc:
      alias __initialize initialize
      def initialize(options)
        normalize_metadata(options)

        if options[:template]
          @store =
            if options[:print_scaling]
              PDF::Core::ObjectStore.new(
                template: options[:template],
                print_scaling: options[:print_scaling]
              )
            else
              PDF::Core::ObjectStore.new(template: options[:template])
            end
          @store.info.data.merge!(options[:info]) if options[:info]
        else
          @store =
            if options[:print_scaling]
              PDF::Core::ObjectStore.new(
                info: options[:info],
                print_scaling: options[:print_scaling]
              )
            else
              PDF::Core::ObjectStore.new(info: options[:info])
            end
        end

        @version = 1.3
        @pages = []
        @page = nil
        @trailer = options.fetch(:trailer, {})
        @compress = options.fetch(:compress, false)
        @encrypt = options.fetch(:encrypt, false)
        @encryption_key = options[:encryption_key]
        @skip_encoding = options.fetch(:skip_encoding, false)
        @before_render_callbacks = []
        @on_page_create_callback = nil
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prawn-templates-0.1.2 lib/pdf/core/document_state.rb
prawn-templates-0.1.1 lib/pdf/core/document_state.rb