Class: PDF::Reader::Resources
- Inherits:
-
Object
- Object
- PDF::Reader::Resources
- Defined in:
- lib/pdf/reader/resources.rb
Overview
mixin for common methods in Page and FormXobjects
Instance Method Summary collapse
-
#color_spaces ⇒ Object
Returns a Hash of color spaces that are available to this page.
-
#fonts ⇒ Object
Returns a Hash of fonts that are available to this page.
-
#graphic_states ⇒ Object
Returns a Hash of external graphic states that are available to this page.
-
#initialize(objects, resources) ⇒ Resources
constructor
: (PDF::Reader::ObjectHash, Hash[untyped, untyped]) -> void.
-
#patterns ⇒ Object
Returns a Hash of patterns that are available to this page.
-
#procedure_sets ⇒ Object
Returns an Array of procedure sets that are available to this page.
-
#properties ⇒ Object
Returns a Hash of properties sets that are available to this page.
-
#shadings ⇒ Object
Returns a Hash of shadings that are available to this page.
-
#xobjects ⇒ Object
Returns a Hash of XObjects that are available to this page.
Constructor Details
#initialize(objects, resources) ⇒ Resources
: (PDF::Reader::ObjectHash, Hash[untyped, untyped]) -> void
13 14 15 16 |
# File 'lib/pdf/reader/resources.rb', line 13 def initialize(objects, resources) @objects = objects @resources = resources end |
Instance Method Details
#color_spaces ⇒ Object
Returns a Hash of color spaces that are available to this page
NOTE: this method de-serialise objects from the underlying PDF
with no caching. You will want to cache the results instead
of calling it over and over.
: () -> Hash[Symbol, untyped]
25 26 27 |
# File 'lib/pdf/reader/resources.rb', line 25 def color_spaces @objects.deref_hash!(@resources[:ColorSpace]) || {} end |
#fonts ⇒ Object
Returns a Hash of fonts that are available to this page
NOTE: this method de-serialise objects from the underlying PDF
with no caching. You will want to cache the results instead
of calling it over and over.
: () -> Hash[Symbol, untyped]
36 37 38 |
# File 'lib/pdf/reader/resources.rb', line 36 def fonts @objects.deref_hash!(@resources[:Font]) || {} end |
#graphic_states ⇒ Object
Returns a Hash of external graphic states that are available to this page
NOTE: this method de-serialise objects from the underlying PDF
with no caching. You will want to cache the results instead
of calling it over and over.
: () -> Hash[Symbol, untyped]
48 49 50 |
# File 'lib/pdf/reader/resources.rb', line 48 def graphic_states @objects.deref_hash!(@resources[:ExtGState]) || {} end |
#patterns ⇒ Object
Returns a Hash of patterns that are available to this page
NOTE: this method de-serialise objects from the underlying PDF
with no caching. You will want to cache the results instead
of calling it over and over.
: () -> Hash[Symbol, untyped]
59 60 61 |
# File 'lib/pdf/reader/resources.rb', line 59 def patterns @objects.deref_hash!(@resources[:Pattern]) || {} end |
#procedure_sets ⇒ Object
Returns an Array of procedure sets that are available to this page
NOTE: this method de-serialise objects from the underlying PDF
with no caching. You will want to cache the results instead
of calling it over and over.
: () -> Array
70 71 72 |
# File 'lib/pdf/reader/resources.rb', line 70 def procedure_sets @objects.deref_array!(@resources[:ProcSet]) || [] end |
#properties ⇒ Object
Returns a Hash of properties sets that are available to this page
NOTE: this method de-serialise objects from the underlying PDF
with no caching. You will want to cache the results instead
of calling it over and over.
: () -> Hash[Symbol, untyped]
81 82 83 |
# File 'lib/pdf/reader/resources.rb', line 81 def properties @objects.deref_hash!(@resources[:Properties]) || {} end |
#shadings ⇒ Object
Returns a Hash of shadings that are available to this page
NOTE: this method de-serialise objects from the underlying PDF
with no caching. You will want to cache the results instead
of calling it over and over.
: () -> Hash[Symbol, untyped]
92 93 94 |
# File 'lib/pdf/reader/resources.rb', line 92 def shadings @objects.deref_hash!(@resources[:Shading]) || {} end |
#xobjects ⇒ Object
Returns a Hash of XObjects that are available to this page
NOTE: this method de-serialise objects from the underlying PDF
with no caching. You will want to cache the results instead
of calling it over and over.
: () -> Hash[Symbol, PDF::Reader::Stream]
103 104 105 106 |
# File 'lib/pdf/reader/resources.rb', line 103 def xobjects dict = @objects.deref_hash!(@resources[:XObject]) || {} TypeCheck.cast_to_pdf_dict_with_stream_values!(dict) end |