Method: Easyzpl::LabelTemplate#variable_bar_code_pdf417

Defined in:
lib/easyzpl/label_template.rb

#variable_bar_code_pdf417(x, y, params = {}) ⇒ Object

This creates a PDF417 bar code, which is very common in the automotive industry. The format is as follows: ^B7o,h,s,c,r,t o = Orientation

N - normal, R rotated 90 degrees clockwise, I inverted 180 degrees
B - Read from bottom up 270 degrees

h = height for individual rows in dots



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/easyzpl/label_template.rb', line 117

def variable_bar_code_pdf417(x, y, params = {})
  x = 0 unless numeric?(x)
  y = 0 unless numeric?(y)
  options = { height: 0.1, width: 0.1 }.merge!(params)

  # update the variable field count
  self.variable_fields_count += 1

  label_data.push('^FO' + Integer(x * printer_dpi).to_s + ',' +
                  Integer(y * printer_dpi).to_s)

  if params[:orientation] == :landscape
    label_data.push('^B7B,')
  else
    label_data.push('^B7N,')
  end

  label_data.push((printer_dpi / 5).to_s + ',0,' + 5.to_s + ',' + 8.to_s +
                  ',N^FN' + variable_fields_count.to_s + '^FS')
end