views:

994

answers:

10

I want to be able to store product information in the database for a web application, I decided it would be good to use the barcode as a good product identifier. Right now I just want to be able to store the numerical representation of the code in the database, so I need to find out maximum lenghts, formats, etc...

Eventually I would like to be able to integrate it with a barcode reader.

Are there any good resources out there to help someone get started with barcode programming?

+2  A: 

There are lots of different formats for barcodes.

If you're not tied to a programming language or a barcode scanner vendor yet, the best place to look is with the scanner vendors to see what libraries they make available. You might find a good match just based on what vendors make libraries available to developers.

Bill the Lizard
+3  A: 

I have done some apps that use barcode scanners, and most of them don't require any special programming. The input typically looks to the program exactly like it came from they keyboard. So just build your data input forms to accept the numeric equivalent of what is stored in the barcode and for most scanners you will be just fine. It is way easier to support than you would initially think.

PRINTING barcodes on the other hand is slightly trickier and usually requires special toolkits. There are free fonts available, but the results can be kind of hit or miss depending on what you are encoding.

JohnFx
+1  A: 

Most barcode readers are pretty simple - as far as the PC is concerned they're just keyboard input. Most current scanners can automatically read and decipher a wide range of encoding schemes. They can be configured to send special pre/postfixes so that your application can detect an input as coming from the scanner, and not just the keyboard. Most scanners can also be configured to tell you the type of barcode being scanned, if that is important to you.

Some barcodes are numeric only, and some are alphanumeric. You might want to be sure you design your db to allow for alphanumeric data, unless you're dead certain that you'll only be dealing with numbers.

Jason
It always makes more sense to store a barcode as a string, not a number. If you tried to do addition with a barcode all it would mean is a corrupt check digit.
joeforker
A: 

Since you didnt specify any language, you should have a look at chapter 12 of Real World Haskell

That may not be exactly what you want but could be interesting/helpful.

daddz
+1  A: 

If you going with cheap barcode readers use Code128. It can encode nearly arbitrary lengths of numbers and/or text (numeric only content hesults in 50% smaller barcodes).

If you want to use cameras/phones for barcode decoding use datamatrix. You can put about 1kb of data into a datamatrix barcode.

Wikipedia has very decent coverage on the topic of barcodes.

Shameless plug: If you are interested in the way barcodes are encoded and decoded you might want to have a look at the free Python Library huBarcode which implements the most common barcode schemes in pure Python. It is published by my company.

Reading barcodes is extremely simple because the scanner simulates a keyboard. So you just have to scan instead of typing. We have several internal web applications which are used on PCs equipped only with scanners and a trackball - no keyboards at all. No special drivers are required for such a setup.

mdorseif
+6  A: 

Based on a number of barcode projects, here's a quick summary.

  1. Your application doesn't need to know or do anything differently because you're using barcodes. They are just a representation of data that might otherwise be printed. The symbology and dimensions can be dealt with in an encapsulated abstraction layer that you put together when you need it.

  2. Symbologies are generally determined by spot requirements, such as customer standards, industry standards, etc. If it's for internal use, Code 39 is generally considered a good default.

  3. For printing, most requirements can be dealt with using a laser printer, special label stock, and downloadable fonts. Special printers are also available from a number of sources, including Zebra, Intermec, etc.; but these are more expensive, and you need to watch out for proprietary (read: expensive) paper to print on.

  4. Fonts. Google for "barcode fonts" in general, but a handy alternative is this Postscript barcode generator that will print most any symbology in most any dimensions on most any Postscript printer.

  5. Reading barcodes. For reading barcodes with a PC input device, normally this is implemented either with a device driver providing your normal open/close/read/write/ioctl equivalents, or as a surrogate keyboard inline with your actual keyboard, so input appears as keystrokes (optionally with a terminal newline.) Non-PC devices obviously have their own programming requirements.

le dorfier
+4  A: 

I have done a fair amount of barcode work.

There's two sides that you will have to become familiar with.

Generating/Printing the Barcodes

This will involve using a specific type of barcode format. Code 128 is usually the most common, easiest to read for most formats, and prints the smallest barcodes. To print Code 128 format barcodes, you requires either a font, library that you can buy (idautomation, etc), and so on that you will integrate into your software to print the barcode. Code 39 is also common (and typically free). It prints really wide barcodes though as your data to be barcoded becomes bigger.

If you are going to print labels with barcodes, you may want to look into Zebra Printers. They have an excellent programming language built in (ZPL) which lets you generate all types of barcodes natively -- no need to buy fonts or libraries.

The important thing to consider here is barcode readability. You will find barcodes scale size wise like a font. ensuring your barcodes can print on your media, and are scannable (wont wrinkle, fold, or peel off, etc) will be very important.

Reading / Using the Barcodes

Reading barcodes will begin with a scanner of some kind. You can get ones that will read any type of barcode and transmit the decoded barcode as input. So, if you had a field selected on your screen, scanned in something, the content of the barcode would be typed into that field for you.

Another thing you could do is buy a mobile scanner running palm OS or windows ce/mobile such as ones made by symbol, psion teklogix, etc. These can be set up to run a piece of integrated software for receiving, shipping systems that will drive your work flow.

I have found life to be a lot easier by not re-inventing the wheel. I have used all of the products I have mentioned above and found they integrate well. There are some superb java barcode libraries as well that are free, I'm sure you will find something for .NET too. Let me know if you have any other questions.

Jas Panesar
+3  A: 

If you have a PostScript environment accessible to your application (via GhostScript, PS-compatible hardware, etc.) then Barcode Writer in Pure PostScript is the richest open source approach.

There are special-purpose bindings for Python and Ruby, and direct use of the resource from any other language is trivial.

+2  A: 

I developed Wallet Zero for the iPhone Wallet Zero Home Page, which generates barcodes that match those on loyalty cards. While working on it, I found a few good references & resources (some have already been mentioned by others):

JJ Rohrer
A: 

You must check out the CueCat.
:-)

pc1oad1etter