Class: DynamicPDFApi::Dim2BarcodeElement

Inherits:
BarcodeElement show all
Defined in:
lib/ruby_client/Elements/Dim2BarcodeElement.rb

Overview

The base class for 2 dimensional barcode (Aztec, Pdf417, DataMatrixBarcode and QrCode).

Instance Attribute Summary collapse

Attributes inherited from BarcodeElement

#_color_name, #value, #x_dimension

Attributes inherited from Element

#_input_value, #_resource, #_text_font, #_type, #even_pages, #odd_pages, #placement, #x_offset, #y_offset

Instance Method Summary collapse

Methods inherited from BarcodeElement

#color=

Constructor Details

#initialize(value, placement, x_offset, y_offset) ⇒ Dim2BarcodeElement

Returns a new instance of Dim2BarcodeElement.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby_client/Elements/Dim2BarcodeElement.rb', line 12

def initialize(value, placement, x_offset, y_offset)
  if value.is_a?(String)
    @_value_type = ValueType::STRING
    super(value, placement, x_offset, y_offset)
  else
    super(value, placement, x_offset, y_offset)
    @_value_type = ValueType::BASE64_ENCODED_BYTES
    @value = Base64.encode64(value.pack('C*'))
    @placement = placement
    @x_offset = x_offset
    @y_offset = y_offset
  end
end

Instance Attribute Details

#_value_typeObject

Returns the value of attribute _value_type.



26
27
28
# File 'lib/ruby_client/Elements/Dim2BarcodeElement.rb', line 26

def _value_type
  @_value_type
end