Class: DynamicPDFApi::StackedGs1DataBarBarcodeElement

Inherits:
TextBarcodeElement show all
Defined in:
lib/ruby_client/Elements/StackedGs1DataBarBarcodeElement.rb

Overview

Represents a StackedGS1DataBar barcode element.

This class can be used to place a StackedGS1DataBar barcode on a page.

Instance Attribute Summary collapse

Attributes inherited from TextBarcodeElement

#_font_name, #_resource, #_text_font, #font_size, #show_text, #text_color

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 TextBarcodeElement

#font, #get_font

Methods inherited from BarcodeElement

#color=

Constructor Details

#initialize(value, stacked_gs1_data_bar_type, row_height, placement = ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0) ⇒ StackedGs1DataBarBarcodeElement

Initializes a new instance of the StackedGs1DataBarBarcodeElement class.

Parameters:

  • value (String)

    The value of the barcode.

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

    The placement of the barcode on the page.

  • stacked_gs1_data_bar_type (String)

    The StackedGS1DataBarType of the barcode.

  • row_height (float)

    The row height of the barcode.

  • x_offset (float) (defaults to: 0)

    The X coordinate of the barcode.

  • y_offset (float) (defaults to: 0)

    The Y coordinate of the barcode.



21
22
23
24
25
26
# File 'lib/ruby_client/Elements/StackedGs1DataBarBarcodeElement.rb', line 21

def initialize(value,  stacked_gs1_data_bar_type, row_height, placement= ElementPlacement::TOP_LEFT, x_offset = 0, y_offset = 0)
  super(value, placement, x_offset, y_offset)
  @_stacked_gs1_data_bar_type = stacked_gs1_data_bar_type
  @row_height = row_height
  @_type = ElementType::STACKED_GS1_DATA_BAR_BARCODE
end

Instance Attribute Details

#_stacked_gs1_data_bar_typeObject

Returns the value of attribute _stacked_gs1_data_bar_type.



28
29
30
# File 'lib/ruby_client/Elements/StackedGs1DataBarBarcodeElement.rb', line 28

def _stacked_gs1_data_bar_type
  @_stacked_gs1_data_bar_type
end

#_typeObject

Returns the value of attribute _type.



28
29
30
# File 'lib/ruby_client/Elements/StackedGs1DataBarBarcodeElement.rb', line 28

def _type
  @_type
end

#expanded_stacked_segment_countObject

Gets or Sets the segment count of the Expanded Stacked barcode.

This is used only for the ExpandedStacked Gs1DataBar type.



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

def expanded_stacked_segment_count
  @expanded_stacked_segment_count
end

#row_heightObject

Gets or sets the row height of the barcode.



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

def row_height
  @row_height
end

Instance Method Details

#to_json(_options = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/ruby_client/Elements/StackedGs1DataBarBarcodeElement.rb', line 42

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

  json_array['type'] = 'stackedGs1DataBarBarcode'

  json_array['stackedGs1DataBarType'] = @_stacked_gs1_data_bar_type unless @_stacked_gs1_data_bar_type.nil?

  unless @expanded_stacked_segment_count.nil?
    json_array['expandedStackedSegmentCount'] =
      @expanded_stacked_segment_count
  end

  json_array['rowHeight'] = @row_height unless @row_height.nil?

  #----------------TextBarcodeElement---------------------------------
  json_array['font'] = @_font_name unless @_font_name.nil?

  json_array['textColor'] = @text_color._color_string if !@text_color.nil? && !@text_color._color_string.nil?

  json_array['fontSize'] = @font_size unless @font_size.nil?

  json_array["showText"] = @show_text unless @show_text.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