barby
barby copied to clipboard
EAN13.rb said to handle UPC-A but it requires 12 digits passed
I padded the number to be represented with the arcode to 12 diits with 0's on left, and it was readable by a UPC-A reader and identified as UPC-A but that was one test. Did I handle this in the correct way?
def barcode_output(barstring)
barcode_string = barstring.to_s.rjust(12,"0")
barcode = Barby::EAN13.new(barcode_string)
# PNG OUTPUT
data = barcode.to_image(height: 40, margin: 10).to_data_url
Digit 13 is a check digit, not part of the data.