Sha256: a51b7147e6f38c71bb7523c258e2a1e75143a7a5d57ef05c0f8a673d33dbe89e

Contents?: true

Size: 648 Bytes

Versions: 2

Compression:

Stored size: 648 Bytes

Contents

module PDF
  module Core
    class ObjectStore #:nodoc:
      def initialize(opts = {})
        @objects = {}
        @identifiers = []

        load_file(opts[:template]) if opts[:template]

        @info ||= ref(opts[:info] || {}).identifier
        @root ||= ref(Type: :Catalog).identifier
        if opts[:print_scaling] == :none
          root.data[:ViewerPreferences] = { PrintScaling: :None }
        end
        if pages.nil?
          root.data[:Pages] = ref(Type: :Pages, Count: 0, Kids: [])
        end
      end

      def utf8?(str)
        str.force_encoding(::Encoding::UTF_8)
        str.valid_encoding?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prawn-templates-0.1.0 lib/pdf/core/object_store.rb
prawn-templates-0.0.5 lib/pdf/core/object_store.rb