Class: DynamicPDFApi::AztecBarcodeElement

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

Overview

Represents an Aztec barcode element.

With some of the .Net runtime (example: .Net Core 2.0) the ECI values 20, 28, 29 and 30 will give the error ‘No data is available for encoding ’code page number’. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.‘.

Instance Attribute Summary collapse

Attributes inherited from Dim2BarcodeElement

#_value_type

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 = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0) ⇒ AztecBarcodeElement

Initializes a new instance of the AztecBarcodeElement class.

Parameters:

  • value (String)

    |[array] The value of the barcode either as string or byte array.

  • placement (String) (defaults to: ElementPlacement::TOP_LEFT)

    The placement of the barcode on the page.

  • x_offset (float) (defaults to: 0)

    The X coordinate of the barcode.

  • y_offset (float) (defaults to: 0)

    The Y coordinate of the barcode.



25
26
27
28
29
30
31
32
# File 'lib/ruby_client/Elements/AztecBarcodeElement.rb', line 25

def initialize(value, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
  @_type = ElementType::AZTEC_BARCODE
  @process_tilde = nil
  @symbol_size = nil
  @aztec_error_correction = 0
  @reader_initialization_symbol = nil
  super(value, placement, x_offset, y_offset)
end

Instance Attribute Details

#aztec_error_correctionObject

Gets or Sets the error correction value.

Error correction value may be between 5% to 95%.



57
58
59
# File 'lib/ruby_client/Elements/AztecBarcodeElement.rb', line 57

def aztec_error_correction
  @aztec_error_correction
end

#process_tildeObject

Gets or Sets a boolean indicating whether to process tilde symbol in the input.

Setting true will check for ~ character and processes it for FNC1 or ECI characters. With some of the .Net runtime (example: .Net Core 2.0), the ECI values 20, 28, 29 and 30 will give the error ‘No data is available for encoding ’code page number’. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.‘.



45
46
47
# File 'lib/ruby_client/Elements/AztecBarcodeElement.rb', line 45

def process_tilde
  @process_tilde
end

#reader_initialization_symbolObject

Gets or Sets a boolean representing if the barcode is a reader initialization symbol.

Setting true will mark the symbol as reader initialization symbol and the size of the symbol should be one of the following, R15xC15 Compact, R19xC19, R23xC23, R27xC27, R31xC31, R37xC37, R41xC41, R45xC45, R49xC49, R53xC53, R57xC57, R61xC61, R67xC67, R71xC71, R75xC75, R79xC79, R83xC83, R87xC87, R91xC91, R95xC95, R101xC101, R105xC105, R109xC109, however it is recommended to set Auto.



67
68
69
# File 'lib/ruby_client/Elements/AztecBarcodeElement.rb', line 67

def reader_initialization_symbol
  @reader_initialization_symbol
end

#symbol_sizeObject

Gets or Sets the barcode size, AztecSymbolSize.



50
51
52
# File 'lib/ruby_client/Elements/AztecBarcodeElement.rb', line 50

def symbol_size
  @symbol_size
end

#typeObject

Returns the value of attribute type.



34
35
36
# File 'lib/ruby_client/Elements/AztecBarcodeElement.rb', line 34

def type
  @type
end

Instance Method Details

#to_json(_options = {}) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/ruby_client/Elements/AztecBarcodeElement.rb', line 69

def to_json(_options = {})
  json_array = {}

  json_array["type"] = "aztecBarcode"

  json_array["processTilde"] = @process_tilde unless @process_tilde.nil?

  json_array["symbolSize"] = @symbol_size unless @symbol_size.nil?

  json_array["aztecErrorCorrection"] = @aztec_error_correction unless @aztec_error_correction.nil?

  json_array["readerInitializationSymbol"] = @reader_initialization_symbol unless @reader_initialization_symbol.nil?

  #--------------Dim2BarcodeElement------------------------------

  json_array["valueType"] = @_value_type unless @_value_type.nil?

  #----------------barcodeElement--------------------------------

  json_array["color"] = @color._color_string if !@color.nil? && !@color._color_string.nil?

  json_array["xDimension"] = @x_dimension unless @x_dimension.nil?

  json_array["value"] = @value unless @value.nil?

  # ------------element---------------------

  json_array["placement"] = @placement unless @placement.nil?

  json_array["xOffset"] = @x_offset unless @x_offset.nil?

  json_array["yOffset"] = @y_offset unless @y_offset.nil?

  json_array["evenPages"] = @even_pages unless @even_pages.nil?

  json_array["oddPages"] = @odd_pages unless @odd_pages.nil?

  JSON.pretty_generate(json_array)
end