First of all, I'm kinda new to the barcode formats and what I do know, I've learned from Wikipedia.
We have some barcodes generated by an existing app that uses the Barcode.4NET library. The barcode is in Code 128A format. The code to generate them is pretty simple, looking something like this:
// Create the barcode
Code128ABarcode c128A = new Code128ABarcode("045746201627080857");
No other parameters are set for it - after setting the data, we just get a GIF version of the barcode back from the library.
I'm working on a new app that is using iTextSharp for PDF generation and I figured that instead of using two libraries, I would use iTextSharp's barcode generation library since it supports Code128 barcodes. It has a few different variations of Code 128, but none of them are "Code 128A".
Here is what the code looks like for it:
Barcode128 code128 = new Barcode128();
code128.CodeType = Barcode.CODE128;
code128.ChecksumText = true;
code128.GenerateChecksum = true;
code128.StartStopText = true;
code128.Code = "045746201627080857";
The image below shows the best I've accomplished so far.
The image on top is generated by iTextSharp and the one on the bottom is generated by Barcode4Net. Obviously, they aren't the same (and not just in the size and the font - the barcoded data is pretty different).
Is anyone out there familiar enough with iTextSharp's (or iText itself) barcode components or with Code 128A barcodes to tell me how to make the iTextSharp one look exactly like the Barcode.4NET one?
Is it really necessary for them to look exactly the same? The different versions of Code 128 are all capable of encoding numbers, even if the barcodes themselves look completely different; the reader should sort it all out in the end.
I prefer the B variant, because it has the lower case letters in addition to the upper case. You can see a table detailing the differences at http://www.barcodeisland.com/code128.phtml
iTextSharp looks like it is generating variant C, which is the most compact if the text is only decimal digits. It encodes 2 digits in the same amount of space as a single character in the other encodings.