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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-01-15 11:00:00 +0000
Seen: 8 times
Last updated: Nov 22 '21
What is the process for installing SASS/Compass in the DDEV web container?
On a remote host, the cursor control and Enter key in Rubymine do not function properly.
How does async execution relate to ruby-odbc?
What is the method of utilizing Ruby to add colored text to the terminal output?
Which languages are appropriate to use for a contemporary website?
How can an HTML form and a MySQL database be updated by several users simultaneously?
What is the process of generating swagger definitions using AWS SDKs?