Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Programming Barcodes: Scanning the Nuances

0.00/5 (No votes)
11 Feb 2013 1  
Scanning the nuances in barcodes.
Over the past few decades barcodes have slowly become a part of everyday life. Every purchase from a supermarket, clothing outlet, or hardware store involves scanning a barcode. Over the last 10 years, interactions with barcode technology have vastly improved. The industry has expanded and innovated to a point where the start-up costs are no longer prohibitive. Unfortunately, companies are not utilizing them to their full potential. Give a developer $100 and ten minutes and a barcode scanning application can be born. The following sections provide a simple overview of interacting with barcodes and scanners.

Understanding Barcodes

There is no single standard format for barcodes. Currently, there are well over 50 different formats available. These formats can be grouped into two categories: Linear and 2D (a.k.a. matrix code). Linear barcodes are the classic thin and thick lined style that use a start and stop delimiter. 2D formats can vary in size and style although the size remains constant within a format. Below are examples of each:

Linear
2D / Matrix Code

The difference between the two is the amount of data contained within the barcode. Linear barcodes are 1-dimensional while 2D codes are 2-dimensional. Although many options exist, there are a few standard/popular styles such as: UPC, Code 39, and QR Code. Some barcode formats such as Code 39 are available as a font. This eliminates the need for programming to perform simple tasks. It also makes testing a breeze. When selecting a barcode format, please research all associated costs. Some are free while others require licensing or membership fees.

Working With Scanners

Barcode scanners range in price from under $100 to a few thousand dollars. The price depends on three attributes: form factor, technology, and barcodes supported. The most common form factors are hand-held, free standing, and mobile. Technology factors include bluetooth and the type of scanning technology used: imager, laser, CCD, or omni-directional. Every barcode scanner has a preset number of barcodes it supports. When selecting a barcode to use, it is important to consider the cost of scanners that support it. USB barcode scanners are an excellent choice for cross platform development. USB is a common standard found in all modern hardware. USB scanners also have the benefit of being automatically installed as a keyboard wedge. This means barcodes will be translated as keyboard data. No special programming required.

Most scanners come with a variety of customization options including special pre/post commands, custom interactions, and much more. For ease of use, it is advisable to stay away from customizing these devices. This can turn into an implementation nightmare and few devices have the same set of custom options available. By default, USB scanners append a keyboard command after every successful scan. This command is either a "tab" or "enter" key.

Building Software

In terms of development, with a basic knowledge of barcodes and scanners the sky is the limit. Utilizing fonts is an excellent option for an installed product, but what about the web? There are a variety of jQuery plug-ins to help with this need that take minutes to implement. They create barcodes for end-users that can be viewed and printed (if necessary). Many associate barcodes with product inventory management. Although this is an excellent use, barcodes can be unitized any time tracking is required. Postal carriers, Amazon, and sports arenas all use barcoding systems. Adding barcode capabilities is a fast and cheap way to broaden a product's offering.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here