Module: Origami::ResourcesHolder

Included in:
Page, Resources
Defined in:
lib/origami/page.rb

Instance Method Summary collapse

Instance Method Details

#add_colorspace(name, colorspace) ⇒ Object



105
106
107
108
109
110
111
112
# File 'lib/origami/page.rb', line 105

def add_colorspace(name, colorspace)
  target = self.is_a?(Resources) ? self : (self.Resources ||= Resources.new)

  csdir = target[:ColorSpace] ||= {}
  (csdir.is_a?(Reference) ? csdir.solve : csdir)[name] = colorspace

  self
end

#add_extgstate(name, extgstate) ⇒ Object



96
97
98
99
100
101
102
103
# File 'lib/origami/page.rb', line 96

def add_extgstate(name, extgstate)
  target = self.is_a?(Resources) ? self : (self.Resources ||= Resources.new)

  target.ExtGState ||= {}
  target.ExtGState[name] = extgstate

  self
end

#add_font(name, font) ⇒ Object



141
142
143
144
145
146
147
148
# File 'lib/origami/page.rb', line 141

def add_font(name, font)
  target = self.is_a?(Resources) ? self : (self.Resources ||= Resources.new)

  target.Font ||= {}
  target.Font[name] = font
  
  self
end

#add_pattern(name, pattern) ⇒ Object



114
115
116
117
118
119
120
121
# File 'lib/origami/page.rb', line 114

def add_pattern(name, pattern)
  target = self.is_a?(Resources) ? self : (self.Resources ||= Resources.new)

  target.Pattern ||= {}
  target.Pattern[name] = pattern

  self
end

#add_properties(name, properties) ⇒ Object



150
151
152
153
154
155
156
157
# File 'lib/origami/page.rb', line 150

def add_properties(name, properties)
  target = self.is_a?(Resources) ? self : (self.Resources ||= Resources.new)

  target.Properties ||= {}
  target.Properties[name] = properties

  self
end

#add_shading(name, shading) ⇒ Object



123
124
125
126
127
128
129
130
# File 'lib/origami/page.rb', line 123

def add_shading(name, shading)
  target = self.is_a?(Resources) ? self : (self.Resources ||= Resources.new)

  target.Shading ||= {}
  target.Shading[name] = shading

  self
end

#add_xobject(name, xobject) ⇒ Object



132
133
134
135
136
137
138
139
# File 'lib/origami/page.rb', line 132

def add_xobject(name, xobject)
  target = self.is_a?(Resources) ? self : (self.Resources ||= Resources.new)

  target.XObject ||= {}
  target.XObject[name] = xobject

  self
end