Class: PDF::Core::ObjectStore
- Inherits:
-
Object
- Object
- PDF::Core::ObjectStore
- Defined in:
- lib/pdf/core/object_store.rb
Overview
:nodoc:
Instance Method Summary collapse
- #__initialize ⇒ Object
- #__utf8? ⇒ Object
-
#initialize(opts = {}) ⇒ ObjectStore
constructor
A new instance of ObjectStore.
- #utf8?(str) ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ ObjectStore
Returns a new instance of ObjectStore.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pdf/core/object_store.rb', line 5 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 |
Instance Method Details
#__initialize ⇒ Object
4 |
# File 'lib/pdf/core/object_store.rb', line 4 alias __initialize initialize |
#__utf8? ⇒ Object
21 |
# File 'lib/pdf/core/object_store.rb', line 21 alias __utf8? utf8? |
#utf8?(str) ⇒ Boolean
22 23 24 25 |
# File 'lib/pdf/core/object_store.rb', line 22 def utf8?(str) str.force_encoding(::Encoding::UTF_8) str.valid_encoding? end |