por BHS » 28 Fev 2008 10:09
to mandando o que achei no site do Dosprinter sobre o código de barras, segue abaixo:
How to print barcodes:
The standard ESC sequence for printing barcodes is ESC ( B nL nH k m s v1 v2 c BarCodeData
where ESC is ASCII 27, ( is ASCII 40, B is ASCII 66,
nL and nH are two bytes representing total number of data bytes to follow, determined by the following equation: (number of data bytes) = 6 bytes + BarCodeData bytes = ((nH*256) + nL). (where 6 bytes are k, m, s, v1, v2, and c). nH is ignored in DOSPrinter. This means you can print barcodes with max 255-6=249 characters, which should be enough.
k is barcode type. Possible values for k and meanings are:
0 = EAN-13
1 = EAN-8
2 = Interleaved 2 of 5
3 = UPC-A
4 = UPC-E
5 = Code 39
6 = Code 128
7 = POSTNET
8 = Code 93
9 = CODABAR
m is barcode width measure. Possible values are 1, 2, 3, 4, 5. 1 is smallest, 5 is largest size.
s is "Space adjustment value". It is ignored by DOSPrinter.
v1 and v2 are barcode length (height) calculated by the formula: inches = (v1 + v2*256) / 180. For 9pin mode emulation the formula is (v1 + v2*256) / 72.
c is Control flag. Each bit of Control flag has a meaning:
if bit 0 is 0: A check digit is not added by DOSPrinter
if bit 0 is 1: A check digit is added by DOSPrinter
if bit 1 is 0: The human readable characters are added by DOSPrinter
if bit 1 is 1: The human readable characters are not added by DOSPrinter
if bit 2 is 0: Flag character is centered (for EAN-13 and UPC-A only)
if bit 2 is 1: Flag character is under (for EAN-13 and UPC-A only)
if bit 3 is 0: For CODE39 and CODE93 only - start and stop characters (*) are added by DOSPrinter.
if bit 3 is 1: For CODE39 and CODE93 only - start and stop characters (*) are not added by DOSPrinter.
Other bits are ignored.
BarCodeData are characters to be printed. Here are some comments about barcode characters: Barcode type
Notes about check character
Notes about BarCodeData characters
EAN-13 The last digit is a checksum digit. DOSPrinter calculates the checksum digit automatically. You have to provide 12 digits. If provided 13 digits, the last digit is ignored and replaced by DOSPrinter in all cases. Valid barcode characters are 13 digits in the range 0 - 9
Invalid characters are replaced with zeroes.
EAN-8 The last digit is a checksum digit. DOSPrinter calculates the checksum digit automatically. You have to provide 7 digits. If provided 8 digits, the last digit is ignored and recalculated by DOSPrinter in all cases. Valid barcode characters are 8 digits in the range 0 - 9
Invalid characters are replaced with zeroes.
UPC-A The last digit is a checksum digit. DOSPrinter calculates the checksum digit automatically. You have to provide 11 digits. If provided 12 digits, the last digit is ignored and recalculated by DOSPrinter in all cases. Valid barcode characters are 12 digits in the range 0 - 9
Invalid characters are replaced with zeroes.
UPC-E The last digit is a checksum digit. DOSPrinter does not calculate the checksum digit automatically for this barcode type. Valid barcode characters are 8 digits in the range 0 - 9
Invalid characters are replaced with zeroes.
First digit (named number system digit) must be 0 or 1.
Interleaved 2 of 5 Optionally, DOSPrinter inserts a mod 10 checksum character at the end, if bit 0 of flag c is set to 1. Valid barcode characters are 0 - 9. Invalid characters are replaced with zeroes.
The specification requires that the barcode must have even number of digits. If you provide odd number of digits, DOSPrinter adds a zero at the beginning to satisfy the specification.
CODE 39 Optionally, DOSPrinter inserts a mod 43 checksum character at the end, before the stop character (*), if bit 0 of flag c is set to 1. The start(*) and stop(*) characters are not required, but (by default) DOSPrinter adds them. You can override the automatic generation of start and stop characters by setting the bit 3 of flag c to 1.
Valid characters are numbers, big letters and characters '-','.',' ','$','/','+','%','*'. Other characters are skipped.
POSTNET The last digit is a checksum digit. DOSPrinter calculates the checksum digit automatically. If you provide the checksum digit, it is ignored and replaced by DOSPrinter. Valid barcode characters are 0 - 9
Valid number of digits are 6, 10 and 12 with the check digit included, or 5, 9 and 11 without the check digit. Only special POSTNET code scanner can read this type of barcode.
CODE 93 Two checksum characters are required for this barcode type. DOSPrinter calculates and inserts them automatically if bit 0 of flag c is set to 1, at the end, before the stop character (*). It is a high-density barcode, suitable for long alphanumeric data.
The start(*) and stop(*) characters are not required, but (by default) DOSPrinter adds them. You can override the automatic generation of start and stop characters by setting the bit 3 of flag c to 1.
Valid are all the ASCII characters with code from 0 to 127.
CODE 128 Checksum character is required for this barcode type. DOSPrinter calculates and inserts one automatically if bit 0 of flag c is set to 1. It is a high-density barcode (especially dense for numbers), suitable for long alphanumeric data.
Valid are all ASCII characters with code 32 to 127. Invalid characters are ignored.
Codabar There is no checksum character for this barcode. You must manually provide the start and stop characters, which could be characters A, B, C or D.
Valid data is numbers 0-9 and characters '-','$',':','/','.' and '+'. Other, invalid characters are ignored.
Download this file for an example of how to use the ESC ( B command.