Class: Pdfrb::Model::Type::Resources

Inherits:
Cos::Dictionary show all
Defined in:
lib/pdfrb/model/type/resources.rb

Overview

Page-resources dict (s7.8). Named lookups for fonts, xobjects, colors, patterns, shadings, extgstate, properties.

Instance Attribute Summary

Attributes inherited from Object

#document, #gen, #oid, #value

Instance Method Summary collapse

Methods inherited from Cos::Dictionary

#[], #[]=, arlington_available?, arlington_default, arlington_key_to_symbol, arlington_loaded_for?, arlington_mark_loaded, arlington_object, arlington_one_type_to_ruby, arlington_required?, arlington_types_to_ruby, arlington_version, define_field, define_field_from_arlington, #delete, #each, each_field, #each_raw, field, #initialize, #key?, #keys, lookup_type, own_fields, #pdf_type, register_type, type_map, #validate

Methods inherited from Object

#==, define_type, #deref, #indirect?, #initialize, #must_be_indirect?, #pdf_type, pdf_type

Constructor Details

This class inherits a constructor from Pdfrb::Model::Cos::Dictionary

Instance Method Details

#color_space(name) ⇒ Object



47
# File 'lib/pdfrb/model/type/resources.rb', line 47

def color_space(name); lookup_named(:ColorSpace, name); end

#color_space_namesObject



32
33
34
# File 'lib/pdfrb/model/type/resources.rb', line 32

def color_space_names
  dict_keys(color_spaces)
end

#color_spacesObject



14
# File 'lib/pdfrb/model/type/resources.rb', line 14

def color_spaces; self[:ColorSpace]; end

#empty?Boolean

Returns:

  • (Boolean)


59
60
61
62
63
# File 'lib/pdfrb/model/type/resources.rb', line 59

def empty?
  %i[Font XObject ExtGState ColorSpace Pattern Shading Properties].all? do |k|
    value[k].nil? || empty_collection?(value[k])
  end
end

#ext_gstate(name) ⇒ Object



46
# File 'lib/pdfrb/model/type/resources.rb', line 46

def ext_gstate(name); lookup_named(:ExtGState, name); end

#ext_gstate_namesObject



28
29
30
# File 'lib/pdfrb/model/type/resources.rb', line 28

def ext_gstate_names
  dict_keys(ext_gstates)
end

#ext_gstatesObject



13
# File 'lib/pdfrb/model/type/resources.rb', line 13

def ext_gstates; self[:ExtGState]; end

#font(name) ⇒ Object



44
# File 'lib/pdfrb/model/type/resources.rb', line 44

def font(name); lookup_named(:Font, name); end

#font_namesObject



20
21
22
# File 'lib/pdfrb/model/type/resources.rb', line 20

def font_names
  dict_keys(fonts)
end

#fontsObject



11
# File 'lib/pdfrb/model/type/resources.rb', line 11

def fonts; self[:Font]; end

#has_procset?(name) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
# File 'lib/pdfrb/model/type/resources.rb', line 52

def has_procset?(name)
  return false unless proc_set

  arr = proc_set.is_a?(Pdfrb::Model::PdfArray) ? proc_set.to_a : proc_set
  arr.is_a?(Array) && arr.include?(name)
end

#pattern(name) ⇒ Object



48
# File 'lib/pdfrb/model/type/resources.rb', line 48

def pattern(name); lookup_named(:Pattern, name); end

#pattern_namesObject



36
37
38
# File 'lib/pdfrb/model/type/resources.rb', line 36

def pattern_names
  dict_keys(patterns)
end

#patternsObject



15
# File 'lib/pdfrb/model/type/resources.rb', line 15

def patterns; self[:Pattern]; end

#proc_setObject



18
# File 'lib/pdfrb/model/type/resources.rb', line 18

def proc_set; self[:ProcSet]; end

#properties(name) ⇒ Object



50
# File 'lib/pdfrb/model/type/resources.rb', line 50

def properties(name); lookup_named(:Properties, name); end

#properties_dictObject



17
# File 'lib/pdfrb/model/type/resources.rb', line 17

def properties_dict; self[:Properties]; end

#shading(name) ⇒ Object



49
# File 'lib/pdfrb/model/type/resources.rb', line 49

def shading(name); lookup_named(:Shading, name); end

#shading_namesObject



40
41
42
# File 'lib/pdfrb/model/type/resources.rb', line 40

def shading_names
  dict_keys(shadings)
end

#shadingsObject



16
# File 'lib/pdfrb/model/type/resources.rb', line 16

def shadings; self[:Shading]; end

#xobject(name) ⇒ Object



45
# File 'lib/pdfrb/model/type/resources.rb', line 45

def xobject(name); lookup_named(:XObject, name); end

#xobject_namesObject



24
25
26
# File 'lib/pdfrb/model/type/resources.rb', line 24

def xobject_names
  dict_keys(xobjects)
end

#xobjectsObject



12
# File 'lib/pdfrb/model/type/resources.rb', line 12

def xobjects; self[:XObject]; end