Free Barcode Font - Barcode String Builder
I've produced a small Visual Studio 2005 assembly (dll) that will convert an input
string into the appropriate string to be provided to produce a valid barcode.
This DLL is free of charge to use and re-distribute, and can be used with both the
free
Code 39
and
Code 128
fonts.

Encode text string to barcode string here
Notes
1) Code 39 does not contain lowercase characters
2) The encoded value for code 39 includes the checksum, this in not a requirement,
refer to the barcode.chm manual for details
3) Only ASCII characters can be converted using code 128
Try this
Using code 128, try converting "A1234B567" and then converting "A12345678".
Both of these string have the same number of characters, but the second string when
encoded is shorter.
Why: This is because code 128 can compress pairs of numbers, but switching
character sets is only economical if the first or last 4 consecutive characters
are numbers or there are more than 6 consecutive numbers to be encoded, clever isn't
it!!.
Downloads
The following downloads are freely available and can be used for any purpose. Why
are they free? well, barcoding has always been a hobby of mine and I can see no
reason why anyone or any company should be charge for this information.
|
VS2005 assembly (DLL) only
|
 |
|
Manual for assembly - barcode.chm |
 |
|
Source code with a test harness program that also includes printing facilities. |
|
|
Code 39 font (for font installation instructions
click here) |
|
|
Code 128 font (for font installation instructions
click here) |
|
Sample code
To use the assembly provided above, add a reference to the assembly within your
Visual Studio 2005 project and then call the static methods as shown below:-
//Define value to hold encoded string
string encodedText;
// Code 39 with Checksum
encodedText = BarCode.BarcodeConverter39.StringToBarcode("TEXTREQUIRED", true);
// Code 39 without Checksum
encodedText = BarCode.BarcodeConverter39.StringToBarcode("TEXTREQUIRED");
// or
encodedText = BarcodeConverter39.StringToBarcode("TEXTREQUIRED", false);
// Code 128 (The checksum is mandatory, and therefore always included)
encodedText = BarCode.BarcodeConverter128.StringToBarcode("TextRequired");
To use these barcodes within a textbox or other control, I would suggest a size
of about 28pt, e.g.
//Code 128
textBox1.Text = BarCode.BarcodeConverter128.StringToBarcode("TextRequired");
textBox1.Font = new Font("Code 128", 28);
//Code 39
label1.Text = BarCode.BarcodeConverter39.StringToBarcode( textBox1.Text.ToUpper(), true );
label1.Font = new Font("Code 3 de 9", 28);
|