Code 128

 1.276.179 descargas (367 ayer)   Dominio público / GPL / OFL

16 comentarios

Tom Evans  02/03/2008
I like the idea of the barcode fonts, they print ok, but the barcode reader cannot decipher them, Am I doing something wrong?
nibblesmx  25/06/2008
Grand Zebu, you rock!!!

You just saved my life man. If there's a way to donate some money, please let me know.

Thanks a lot dude
rjskoko  19/09/2009
The Code 128 symbology has particular start and stop characters and a check sum. Look on Wikipedia or Google for Code 128 to find the "rules".
rjskoko  19/09/2009
Additional: Try this site to generate a graphic of a valid symbol (supports a large number of symbologies) if you only need a single symbol (or to generate a symbol to verify yours against):
pushkar1210  29/12/2014
Hi nibblesmx,
I want to print bar code - Code128 font with the following data.
123 ABC
the data contains space in between and code 128 does not support. can anybody help me?

nonlinearly  18/03/2015
Hi. I used these fonts but barcode are not identified by the barcode reader. As "rjskoko" said must include the start and stop characters. In wikipedia say that start character in code 128 C is the ascii code 210 but how can I type it? Also as I see there isn't barcode for this ascii in the fonts!
nonlinearly  18/03/2015
They do not work. The stop character Î (ASCII 206) is not the same as it appears to this web page!!!
karnaugh  02/10/2015
I have confirmed that this barcode DOES work. You must use the correct start and stop characters, and remember the checksum character right before the stop. Go to this page for an automatic string generator so you don't have to manually calculate them:
david aguilar  02/06/2016
I've implemented this font to print voucher codes, I choose Code 128 B but when the result of the checksum is a character for example 127, it prints a white square. This is part of the code that I wrote. This code works for me, most of times.

Private Sub onPrint(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
Dim printFont As New Font("code 128", 40)
Dim stringToBarCode As String = "251250000156"
Dim intChar As Integer
Dim stringBuild As New StringBuilder
Dim checksum As Integer = 104
Dim i As Integer = 1
Dim crcResult As Integer
For Each c As Char In stringToBarCode.ToCharArray
intChar = Encoding.ASCII.GetBytes(c)(0)
If intChar >= 32 And intChar <= 126 Then
checksum += (intChar - 32) * i
i += 1
End If
If checksum > 104 Then
crcResult = (checksum Mod 103) + 32
ev.Graphics.DrawString(stringBuild.ToString, printFont, Brushes.Black, 1, 1)
End If
End Sub

How can it be solved?, Do I need to edit the font? if so, how can i do it?
Holger Will  19/09/2016
this has no characters for start, and stop codes.

Start A is ascii 208, start B is ascii 209 and start c ascii 210. The stop code is allways 211. All these characters are not available with this font...
abbass  04/02/2017
a.f.ortega  26/06/2017
Help me please, i printed card with id but donīt put start, stop codes or digi controller, and then the reader canīt read my codebar, exist a solution ?
a.f.ortega  26/06/2017
Help me please, i printed card with id but donīt put start, stop codes or digi controller, and then the reader canīt read my codebar, exist a solution ?
InklingTrainer  20/08/2018
I used this encoder. The other link didn't work for me.
CirasaEric  13/11/2018
Thanks to David Aguilar and the info on Wikipedia I fixed the code to use this font. (Below the c# code)

public string Code128(string toEncode)
StringBuilder Encoded = new StringBuilder();

//Start code
int sum = 104;
for (int i = 0; i < toEncode.Length; i++)
sum += ((char)toEncode[i] - 32) * (i+1);

sum = sum % 103;
sum += 32;

//Checksum between 94 and 103 are encoded in the 200 - 206 range
if (sum > 94 && sum < 103)
sum += 105;

//Stop code

return Encoded.ToString();

The Difference with the code of David is that if the checksum values is in the 95-102 we have the correct font on ASCII (200-207). I made several test and it works.
lordparadraculo  15/07/2019
Hello, CirasaEric. Thanks for the code. Could you please give us instructions on how to use this code. When I try to use putting it in a macro it give me a sintax error.
Your help will be really appreciated.

Conexión para adjuntar un comentario.

Política de Privacidad  -  Contacto
Links:  On snot and fonts