tags:

views:

153

answers:

4

Hi all,

I did like to print a barcode using C#. I want the barcode to have a given height and width. I did download a free 3 of 9 barcode font and used

 Font barcodeFont = new Font("Free 3 of 9", 17, FontStyle.Regular);
 e.Graphics.DrawString("*"+label.Lpn+"*", barcodeFont, Brushes.Black,new RectangleF(166,235,115.16f,61)); 

to print it. I have two issues with this.

  1. ) for some font size barcode is printed in two line.
  2. ) even if I reduce the font and make it print in one line. The barcode does not scan well. I have to swipe it in a perticular way to make it work.

Is there a better way to print barcode which will scan every time??

+2  A: 

There are minimum and maximum widths for the lines and spaces of a 3of9 barcode.

Take a look at this website for more info about these measurements: http://www.adams1.com/39code.html

Danny T.
A: 

Code 3 of 9 does tend to be quite a wide barcode and the only way you'll really solve your problem is by giving it more space on the page.

An alternative to this would be to either encode your data so it takes up less characters/bars or instead do a database lookup, so 1 = Bananas, 2 = Apples, 3=VeryLongWordThatDoesntFit etc.

Another alternative would be to improve the quality of the barcode scanner. It is true with barcode scanners that the more you spend the better results you get.

CResults
+1  A: 

Take a look here at CodeProject for a decent Barcode generator. This is capable of generating different types of Barcodes including 3 of 9.

Hope this helps, Best regards, Tom.

tommieb75
I have found that barcodes generated as images, like the ones from CodeProject, create better quality codes than ones generated as fonts.
Dour High Arch
A: 

Does the barcode font provide recommended point sizes? A free font might not have the hinting required to insure that each bar is an integral number of pixels wide. This might be a problem especially if your printer has an odd DPI. I'm aware of one model of label printer that is 203 DPI, good luck matching your font size to pixels on that printer!

Mark Ransom
203 DPI is 8 dots per mm, so it's not an uncommon number in European and Japanese printers.
Gabe