tags:

views:

48

answers:

2

I've inherited the source to a legacy VB6 barcode library with no documentation. My understanding is it translates an 11-digit number to UPC barcode (I hope I have that right, it might be EAN-8).

As far as I can tell, the check digit (right-most trailing number) is calculating correctly, buy the overhead digit (left-most leading number) is not.

The digit is translated by converting the first digit in the source number to a corresponding ASCII value. 1 becomes Chr(34), 2 becomes Chr(35) and so on. The problem is 6 and 0 (zero). I guess 6 should be Chr(39) (apostrophe), but the barcode doesn't scan. I'm not sure what zero should be. I've tried both Chr(33) (exclamation) and Chr(45) (dash) and barcodes scan for neither. All other translated digits scan fine.

I'm hoping someone has either done this before and know what these should be, or knows a reference on the web. I've tried Googling, but all I can find is the general format of the barcode and how to calculate the check digit, but nothing on translating the overhead digit.

Edit 1: for what it's worth, I've also seen this digit refered to as a type digit and inidcator digit.

Edit 2: this is actually a bad question on my part because I didn't know what I was asking. Turns out 1) I was working with a specific commercial barcode font, and 2) I needed more than the overhead digit. I answered my own question with what I was able to find, but in all honesty my answer turns out to have very little to do with my question after all.

A: 

First, I've never done anything like this, but I have pretty good google skills. This page looks like it has some pretty complete information. The table listing the UPC / EAN guard patterns and special characters do not agree with yours though so you'll have to let me know if this was any help or a waste of time. alt text

Beaner
A good start, but unfortunately incomplete for my needs. Turns out I needed character codes for the barcode glyphs as well for a particular commercial barcode font. Please see my answer for more info if interested.
Michael Itzoe
A: 

Turns out the real problem wasn't so much the algorithm (though it was incorrect) but that this library was written specifically for use with Wasp barcode fonts. What I was really needing was how to create the mechanical output that would then be rendered as a valid barcode by the font.

After much digging, I was able to find this page. Though written in Visual FoxPro, I was able to translate it to VB6 to create the algorithm I needed.

Michael Itzoe
I ended up creating my own code to generate barcode images rather than relying on fonts, so that I wouldn't have this problem.
Mark Ransom