Agile Web Development

Build it. Launch it. Love it.

Barcode Generator

Barcode Generator - ReDux

Barcode generator makes generating/displaying bar-codes for certain alphanumeric ids a piece of cake.

It uses Gbarcode for encoding barcode data and then Rmagick to generate images out of it for displaying in views.

This way we can generate any barcode type which Gbarcode -> Gnome Barcode project supports.

USAGE

its as simple as saying

<%= barcode ‘FJJ4JD’%>

This will generate a barcode for FJJ4JD in BARCODE_39 format with default width and height and include it in the view. the images are stored in /public/images/barcodes subdir.

Options Options Options ..

to customize your barcodes, you can optionally pass following information in your views

 * encoding_format (Gbarcode constants for eg. Gbarcode::BARCODE_128 etc..)
 * width
 * height
 * scaling_factor
 * xoff
 * yoff
 * margin

in this case your view will look like :

<%= barcode ‘ANUJ’, :height => 100,

                    :width  => 400,
                    :margin => 100,
                    :xoff   => 20,
                    :yoff   => 40

%>

Installation

install from svn :

script/plugin install http://barcode-generator.googlecode.com/svn/trunk/barcode_generator

make sure that you install gems for rmagick and gbarcode first!!!

and then run the rake task : rake barcode_setup

Vitals

Home http://code.google.com/p/barcode-generator/
Repository http://barcode-generator.googlecode.com/svn/trunk/
License GPL
Tags Tag_red barcode barcode gbarcode helper view
Rating (13 votes)
Owner Anuj Luthra
Created 7 May 2007

Comments

  • mike
    18 July 2007

    i was tring to do rake barcode_generator and it says do't know how to build barcode_generator

  • Avatar
    anuj
    21 July 2007

    its "rake barcode_setup"

  • paul chin
    6 August 2007

    It works, but it hang on second run. you know why?

  • Avatar
    John
    21 September 2007

    it works fine when using the default encoding, but I can't seem to change it.. and I don't seem to get any clues in the logs as to why. Can I get an example of what a tamplate tag would look like that selects the encoding?

  • Avatar
    anuj
    29 September 2007

    there is more information on the project website.

    For eg. if you want to use base 128 encoding, you would write something like this in your view:

    <%= barcode "test123", :encoding_format => Gbarcode::BARCODE_128 %>

    You can choose which ever encoding format you like (and is supported by GBarcode), and pass it to the helper as a GBarcode constant.

  • Avatar
    10 October 2007

    Hi Anju, Thanks for taking the time to make this plugin. I know that for some folks, RMagick is not a nice option, so I developed a small wrapper that uses Cairo instead. Please see my blog post here for details:

    http://defsci.blogspot.com/2007/10/easy-gbarcode.html

Add a comment