So I inherited this code, or should I say, someone developed this and moved on and now we are having a problem with it and I'm looking into it...
We are generating c128 barcodes and upon having them certified they noticed an issue that I can't see to figure out. The width of a bars/spaces is 10.5 mils and they acceptable range is 15-21 mils (1 mil = .001 inch).
The rendering code is based off this library: http://www.codeproject.com/KB/GDI-plus/GenCode128.aspx but has been modified some...
The barcodes being generated are all alpha-numeric, no special characters. I thought the width of the bar + space was dependent on the character being encoded.
Here are the settings being used:
settings.Font = new Font ( FontFamily.GenericSansSerif, 12 );
settings.TopMargin = 10
settings.BottomMargin = 10
settings.LeftMargin = 10
settings.RightMargin = 10
settings.BarCodeHeight = 80
settings.DrawText = true
settings.BarCodeToTextGapHeight = 10
settings.InterCharacterGap = 2
If I was guessing, I think it's because the width of the bars is being based on the height of the barcode instead of the height of the barcode being based on the length of the text and barcode. But I'm not too familiar with the spec (even after reviewing it), and I'm a novice C# programmer at best...
This isn't a direct answer BUT I would strongly recommend to use a well-tested library for generating barcodes... getting barcodes right isn't easy since there are some pitfalls... there are tons of libraries out there some commercial, some free...
2 free barcode libraries for .NET:
http://barcoderender.codeplex.com/
http://www.codeproject.com/KB/graphics/BarcodeLibrary.aspx