Barby is a Ruby library that generates barcodes in a variety of symbologies.
Its functionality is split into barcode and "outputter" objects:
- [
Barby::Barcode
objects] symbologies turn data into a binary representation for a given symbology. - [
Barby::Outputter
] outputters then takes this representation and turns it into images, PDF, etc.
You can easily add a symbology without having to worry about graphical representation. If it can be represented as the usual 1D or 2D matrix of lines or squares, outputters will do that for you.
Likewise, you can easily add an outputter for a format that doesn't have one yet, and it will work with all existing symbologies.
For more information, check out the Barby wiki.
Barcode symbologies are no longer required automatically, so you'll have to require the ones you need.
If you need EAN-13, require 'barby/barcode/ean_13'
. Full list of symbologies and filenames below.
require 'barby'
require 'barby/barcode/code_128'
require 'barby/outputter/ascii_outputter'
barcode = Barby::Code128B.new('BARBY')
puts barcode.to_ascii #Implicitly uses the AsciiOutputter
## # # # # ## # # ## ## # ### # # ## ### ## # ## ### ### ## ### # ##
## # # # # ## # # ## ## # ### # # ## ### ## # ## ### ### ## ### # ##
## # # # # ## # # ## ## # ### # # ## ### ## # ## ### ### ## ### # ##
## # # # # ## # # ## ## # ### # # ## ### ## # ## ### ### ## ### # ##
## # # # # ## # # ## ## # ### # # ## ### ## # ## ### ### ## ### # ##
## # # # # ## # # ## ## # ### # # ## ### ## # ## ### ### ## ### # ##
## # # # # ## # # ## ## # ### # # ## ### ## # ## ### ### ## ### # ##
## # # # # ## # # ## ## # ### # # ## ### ## # ## ### ### ## ### # ##
## # # # # ## # # ## ## # ### # # ## ### ## # ## ### ### ## ### # ##
## # # # # ## # # ## ## # ### # # ## ### ## # ## ### ### ## ### # ##
B A R B Y
require 'barby/barcode/<filename>'
Name | Filename | Dependencies |
---|---|---|
Code 25 | code_25 |
β |
ββ Interleaved | code_25_interleaved |
β |
ββ IATA | code_25_iata |
β |
Code 39 | code_39 |
β |
ββ Extended | code_39 |
β |
Code 93 | code_93 |
β |
Code 128 (A, B, and C) | code_128 |
β |
ββ GS1 128 | gs1_128 |
β |
Codabar | codabar |
β |
EAN-13 | ean_13 |
β |
ββ Bookland | bookland |
β |
ββ UPC-A | ean_13 |
β |
EAN-8 | ean_8 |
β |
UPC/EAN supplemental, 2 & 5 digits | upc_supplemental |
β |
QR Code | qr_code |
rqrcode |
DataMatrix (Semacode) | data_matrix |
semacode or semacode-ruby19 |
PDF417 | pdf_417 |
JRuby |
require 'barby/outputter/<filename>_outputter'
filename | dependencies |
---|---|
ascii |
β |
cairo |
cairo |
html |
β |
pdfwriter |
β |
png |
chunky_png |
prawn |
prawn |
rmagick |
rmagick |
svg |
β |
- Text (mostly for testing)
- PNG, JPEG, GIF
- PS, EPS
- SVG
- HTML
For more information, check out the Barby wiki.