1 | initial version |
Here are the steps to create a GS1-128 barcode using Ruby on Rails:
Install the barby
and barby-ean-ucc
gems in your Rails application.
gem install barby
gem install barby-ean-ucc
Create a new barcode object using the Barby::EAN128
class.
barcode = Barby::EAN128.new('01012345678901234567890')
Render the barcode using a renderer. In this example, we'll use the Barby::PngOutputter
to output the barcode as a PNG image.
png_data = Barby::PngOutputter.new(barcode).to_png
Optionally, you can save the barcode image to a file.
File.open('barcode.png', 'wb') { |f| f.write png_data }
That's it! You now have a GS1-128 barcode generated in Ruby on Rails.