Method: HexaPDF::Content::Canvas#context

Defined in:
lib/hexapdf/content/canvas.rb

#contextObject (readonly)

The context for which the canvas was created (a HexaPDF::Type::Page or HexaPDF::Type::Form object).

The context object is used for two things:

  • To store the resources (#resources) that are needed by the canvas (e.g. font references).

  • To access the HexaPDF::Document object to which this canvas and the context object belongs. This is used internally but it is also useful in other situations since some parts of HexaPDF only yield a canvas object, and not also the underlying document object.



225
226
227
# File 'lib/hexapdf/content/canvas.rb', line 225

def context
  @context
end