Skip to content

Instantly share code, notes, and snippets.

@house9
Created October 15, 2011 15:57
Show Gist options
  • Save house9/1289751 to your computer and use it in GitHub Desktop.
Save house9/1289751 to your computer and use it in GitHub Desktop.
# Gemfile, run bundle install after adding
gem 'barby'
gem 'chunky_png'
# some code to generate the png file using 3 of 9 barcode style
require 'barby'
require 'barby/barcode/code_39'
require 'barby/outputter/png_outputter'
barcode_value = "099999333"
full_path = "/somewhere/barcode_#{barcode_value}.png"
barcode = Barby::Code39.new(barcode_value)
File.open(full_path, 'w') { |f| f.write barcode.to_png(:margin => 3, :xdim => 2, :height => 55) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment