Class: DynamicPDFApi::Pdf417BarcodeElement

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

Overview

Represents Pdf417 barcode element.

This class can be used to generate Pdf417 barcode symbol.

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, #even_pages, #odd_pages, #placement, #x_offset, #y_offset

Instance Method Summary collapse

Methods inherited from BarcodeElement

#color=

Constructor Details

#initialize(value, columns, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0) ⇒ Pdf417BarcodeElement

Initializes a new instance of the Pdf417BarcodeElement class.

Parameters:

  • value (String)

    |array String to be encoded either as string or byte array.

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

    The placement of the barcode on the page.

  • columns

    int [Columns] of the PDF417 barcode.

  • x_offset (float) (defaults to: 0)

    The X coordinate of the PDF417 barcode.

  • y_offset (float) (defaults to: 0)

    The Y coordinate of the PDF417 barcode.



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ruby_client/Elements/Pdf417BarcodeElement.rb', line 22

def initialize(value,  columns, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
  @columns = nil
  @y_dimension = nil
  @process_tilde = nil
  @compact_pdf417 = nil
  @error_correction = nil
  @compaction = nil

  super(value, placement, x_offset, y_offset)
  @columns = columns
  @_type = ElementType::PDF417_BARCODE
end

Instance Attribute Details

#_typeObject

Returns the value of attribute _type.



35
36
37
# File 'lib/ruby_client/Elements/Pdf417BarcodeElement.rb', line 35

def _type
  @_type
end

#columnsObject

Gets or sets the columns of the barcode.



40
41
42
# File 'lib/ruby_client/Elements/Pdf417BarcodeElement.rb', line 40

def columns
  @columns
end

#compact_pdf417Object

Gets or sets the Compact Pdf417.



54
55
56
# File 'lib/ruby_client/Elements/Pdf417BarcodeElement.rb', line 54

def compact_pdf417
  @compact_pdf417
end

#compactionObject

Gets or sets the type of compaction.



62
63
64
# File 'lib/ruby_client/Elements/Pdf417BarcodeElement.rb', line 62

def compaction
  @compaction
end

#error_correctionObject

Gets or sets the error correction level for the PDF417 barcode.



58
59
60
# File 'lib/ruby_client/Elements/Pdf417BarcodeElement.rb', line 58

def error_correction
  @error_correction
end

#process_tildeObject

Gets or Sets a boolean indicating whether to process the tilde character.



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

def process_tilde
  @process_tilde
end

#y_dimensionObject

Gets or sets the YDimension of the barcode.



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

def y_dimension
  @y_dimension
end

Instance Method Details

#to_json(_options = {}) ⇒ Object



64
65
66
67
68
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
# File 'lib/ruby_client/Elements/Pdf417BarcodeElement.rb', line 64

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

  json_array['type'] = 'pdf417Barcode'

  json_array['columns'] = @columns unless @columns.nil?

  json_array['yDimension'] = @y_dimension unless @y_dimension.nil?

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

  json_array['compactPdf417'] = @compact_pdf417 unless @compact_pdf417.nil?

  json_array['errorCorrection'] = @error_correction unless @error_correction.nil?

  json_array['compaction'] = @compaction unless @compaction.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