I'm writing an application that needs to print barcode labels using the Code39 spec. Do you know of any source code which I can use to draw text in Code39 format?
Thanks in advance!
Alvaro
Printable View
I'm writing an application that needs to print barcode labels using the Code39 spec. Do you know of any source code which I can use to draw text in Code39 format?
Thanks in advance!
Alvaro
code 39 is a font, you can use the font in your reports. crystal report have this font and also Corel Draw
Hi,
you might want to look there:
AIM USA AUTOMATIC IDENTIFICATION
MANUFACTURERS INC.
634 Alpha Drive
Pittsburgh, PA 15238-2802
Telephone: 412.963.8588
Telefax: 412.963.8753
Contact:
Larry Roberts, Executive Director
Dan Mullen, Director of Technical Services
Steve Halliday, VP Technology
* ANSI/AIM-BC1, Uniform Symbol Specification - Code 39 (1995)
* ANSI/AIM-BC2, Uniform Symbol Specification - Interleaved 2 of 5 (1995)
* ANSI/AIM-BC3, Uniform Symbol Specification - Codabar (1995)
* ANSI/AIM-BC4, Uniform Symbol Specification - Code 128 (1995)
* ANSI/AIM-BC5, Uniform Symbol Specification - Code 93 (1995)
* ANSI/AIM-BC6, Uniform Symbol Specification - Code 49 (1995)
* ANSI/AIM-BC7, Uniform Symbol Specification - Code 16K (1995)
* Uniform Symbol Specification - PDF417 (1994)
* Uniform Symbol Specification - Code One (1994)
* Uniform Symbol Specification - Data Matrix (1995)
* Uniform Symbol Specification - MaxiCode (1995)
* Symbology Identifiers (1990)
* Film Master Certification Program
* Small Animal RFID Specification (Draft)
* Channel Code (in discussion - 1995)
There might be a PDF version out in the net.
Dieter Fauth, Welch Allyn DCD
Dieter Fauth :-)
Hi, again and again
this might be good for you:
http://www.adams1.com/pub/russadam/stack.html
Dieter Fauth, Welch Allyn DCD
PS: In case you need support for 2D barcodes, think about using Aztec code. The printing routines are free!
Dieter Fauth :-)
Thanks to everyone who replied to my message.
I searched everywhere and found some Java code that did what I wanted. So I converted it to C++/MFC and here it is, in case anyone's interested:
void DrawBarcodeText(CDC& dc, int nX, int nY, const CString& strText, int nHeight, double dWideToNarrowRatio)
{
static CString s_strCode39Alphabet= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*";
static char* s_arrayCode39Characters[] =
{
/* 0 */ "000110100", /* 1 */ "100100001", /* 2 */ "001100001", /* 3 */ "101100000",
/* 4 */ "000110001", /* 5 */ "100110000", /* 6 */ "001110000", /* 7 */ "000100101",
/* 8 */ "100100100", /* 9 */ "001100100", /* A */ "100001001", /* B */ "001001001",
/* C */ "101001000", /* D */ "000011001", /* E */ "100011000", /* F */ "001011000",
/* G */ "000001101", /* H */ "100001100", /* I */ "001001100", /* J */ "000011100",
/* K */ "100000011", /* L */ "001000011", /* M */ "101000010", /* N */ "000010011",
/* O */ "100010010", /* P */ "001010010", /* Q */ "000000111", /* R */ "100000110",
/* S */ "001000110", /* T */ "000010110", /* U */ "110000001", /* V */ "011000001",
/* W */ "111000000", /* X */ "010010001", /* Y */ "110010000", /* Z */ "011010000",
/* - */ "010000101", /* . */ "110000100", /*SPACE*/"011000100",/* $ */ "010101000",
/* / */ "010100010", /* + */ "010001010", /* % */ "000101010", /* * */ "010010100",
/*INVALID*/ "000000000"
};
// Add the start/stop characters
CString strToEncode = _TCHAR('*') + strText + _TCHAR('*');
CString strEncoded;
for (int iPos = 0, nLen = strToEncode.GetLength(); iPos < nLen - 1; iPos++)
{
int nChar = s_strCode39Alphabet.Find(strToEncode[iPos]);
if (nChar < 0)
nChar = 44; // invalid character
strEncoded += (s_arrayCode39Characters[nChar] + CString(_T("0")));
}
strEncoded += s_arrayCode39Characters[s_strCode39Alphabet.Find(strToEncode[iPos])];
double dNarrowestWidth = 1.0;
CRect rect(nX, nY, 0, nY + nHeight);
COLORREF colorChar = 0;
// Loop through all the characters and decode each 1 and 0 into a bar
for (iPos = 0, nLen = strEncoded.GetLength(); iPos < nLen; iPos++)
{
int nValue = (int)(dNarrowestWidth + 0.5);
if (strEncoded[iPos] == _TCHAR('1'))
nValue = (int)((dWideToNarrowRatio * dNarrowestWidth) + 0.5);
rect.right = rect.left + nValue;
if (iPos % 2 == 0)
{
for (int iPix = rect.left; iPix < rect.right; iPix++)
{
dc.MoveTo(iPix, rect.top);
dc.LineTo(iPix, rect.bottom);
}
}
rect.left += rect.Width();
}
}
Alvaro
Thanks for sharing your snippet. I have added it to my tips and tricks collection.
This subject could make an interesting article for codeguru (hint,hint :) to
illustrate how this kind of stuff is used. I know that I am curious.