Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Printing Barcodes with ESC/P on Epson Impact Printer

1,243 views
Skip to first unread message

JJ Jones

unread,
Oct 25, 2006, 5:43:54 PM10/25/06
to
Hello,

Does anybody know how to print barcodes on an Epson impact printer
(FX-2190 or FX-2170) using ESC/P?

Using the ESC/P manual, I entered two sequences that were supposed to
print barcodes, and neither of them printed. In fact, they froze the
printer.

I'm using the manual titled "Epson ESC/P Reference Manual, December
1997". In the "Recommended Operations" section, there are many
examples of numeric sequences that are supposed to print barcodes, but
I can't get them to work. I tried two:

At the top of page R-95, I sent the following hex numbers to the
printer: 1B,28,42,0D,00,04,02,00,7D,00,03,30,31,32,33,34,35,30, but it
didn't generate the example barcode.

At the bottom of page R-93, I sent the hex numbers:
1B,28,42,12,00,04,02,00,7D,00,00,30,31,32,33,34,35,36,37,38,39,30,35,
but it also didn't print the example barcode.

When doing this, I first turned the printer off & on, to initialize it,
then I sent the hex string. My guess is that there is some magic
number that I'm missing that will initialize the printer properly, or
put it into graphics mode or something.

Any ideas?

Thanks

Justin C

unread,
Oct 25, 2006, 6:38:27 PM10/25/06
to
In article <1161812634....@m7g2000cwm.googlegroups.com>,
"JJ Jones" <jamesjona...@yahoo.com> wrote:

> Hello,
>
> Does anybody know how to print barcodes on an Epson impact printer
> (FX-2190 or FX-2170) using ESC/P?
>

[snip]

I wish you well with this. We've an Epson thermal label/barcode printer
which also uses ESC/P. I've never got further than having MS Word print
to it from Win98. I'd like to get it printing barcodes though - I found
the ESC/P manuals too baffling for my small brain.

What I have seen suggested here in the past is kbarcode. I don't know
how well it's maturing but it's probably worth a look. If you are able
to produce *any* code that produces reliable output from an ESC/P
printer I'd very much like to see it - as a starting point for my own
endeavours, especially seeing as I don't even know where to start with
this!

--
Justin C, by the sea.

JJ Jones

unread,
Oct 26, 2006, 8:48:48 AM10/26/06
to
Actually, ESC/P has been pretty reliable for simple things like
changing font sizes, etc. But I haven't gotten to first base on
barcodes or even graphics code. I would also like to use some simple
graphics, like blacking-out something with a solid black square.

One thing I found out is that there is a 1998 ESC/P manual which has a
somewhat different escape sequence for barcodes than the 1997 manual
that I have. For example, the 1997 manual shows the length as 2 bytes
- an int and a mod. While the 1998 manual shows it as a "word". I
assume a "word" is 4 bytes in this case.

I'll try to track down the latest manual.

Martin Gregorie

unread,
Oct 26, 2006, 8:03:59 AM10/26/06
to
Are you sure that your particular printer can understand that escape
sequence and/or print bar codes?

Whenever I've written code to send Esc/P sequences to Epsons it has
always "just worked". Epson parallel printers are generally backward
compatible: my Epson Stylus Colour 850 produces perfectly formatted
output when driven by programs developed to drive an LQ-550 (24 pin dot
matrix) or even an MX-80 (9 pin dot matrix).

It could be worth writing a simple "echo" equivalent so you can enter
hex control sequences and ASCII text via a command line.

I have dim memories that it may help to end each string with CR/LF
because some Epsons contain a line buffer that isn't printed until the
CR/LF sequence is received.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

Lee

unread,
Oct 26, 2006, 1:02:51 PM10/26/06
to
I used to use these all the time to print bar codes!
You are going about it the wrong way.
First, there are DIP switches that have to be set to allow graphics mode.
Then, instead of sending code sequences, you use software that prints
the kind of bar codes you want. There are many kinds of bar codes.
The sequences you are playing with are for programmers.
Firstly, determine what kind of bar codes you want.
Second, find software to do it.
There is freeware software to do just about anything you want.
i.e. type 'freeware barcode software' in Google and you will find all
kinds of things.
Regards
Lee

Robert Newson

unread,
Oct 26, 2006, 2:17:32 PM10/26/06
to
JJ Jones wrote:

> Actually, ESC/P has been pretty reliable for simple things like
> changing font sizes, etc. But I haven't gotten to first base on
> barcodes or even graphics code. I would also like to use some simple
> graphics, like blacking-out something with a solid black square.

Thing with graphics is there are various "modes" which the printer may, or
may not, understand, in particular 8 & 24 bit graphics (for 9 & 24 pin
printers). The difference being that more bits are stacked vertically for
the latter - 3 bytes are used to define the stack of bits to printer as
opposed to just 8.

When printing graphics, a stack of bits is scanned across each line - you
need to specify /exactly/ how many stacks of bytes are being sent so that
the printer with accept the full 8 bits for the next n bytes before resuming
normal character/control interpretation.

Similarly when doing bar codes: you will need to specify exactly how many
data bytes are being sent to the command (the data for the bar code, plus
the preamble which specifies the bar code type and size, etc).

> One thing I found out is that there is a 1998 ESC/P manual which has a
> somewhat different escape sequence for barcodes than the 1997 manual
> that I have. For example, the 1997 manual shows the length as 2 bytes
> - an int and a mod. While the 1998 manual shows it as a "word". I
> assume a "word" is 4 bytes in this case.

I would presume the word to be 16 bit, or 2 words, and giving the same result.
...

>>I wish you well with this. We've an Epson thermal label/barcode printer
>>which also uses ESC/P. I've never got further than having MS Word print
>>to it from Win98. I'd like to get it printing barcodes though - I found
>>the ESC/P manuals too baffling for my small brain.

Examining the original example:

1B,28,42,0D,00,04,02,00,7D,00,03,30,31,32,33,34,35,30

or as characters:

<ESC> ( B [13] [0] [4] [2] [0] [125] [0] [3] 0 1 2 3 4 5 0

We have (presuming data correct):

<ESC> - command prefix
( - Command: an extended one, next char gives actual command
B - Command: print a bar code
[13][0] - A lo-hi (little-endian 16 bit word) length of data to follow
(13 bytes)
[4] - Bar code type: 4 = UPC-E
[2] - Module Width: 2 dots
[0] - Space adjustment (none)
[125][0] - A lo-hi Bar length = 125 units
[3] - Control flag: 0000 0011 = No human readable chars
Printer adds check digit
0..0 - Bar code data (7 as printer adds 8th check digit) - 0123450

The size of the unit depends upon the printer and the parameter. 24 pin
printers using a smaller unit than 9 pin printers.

I vaguely remember when testing bar codes (when working in mail order retail
years ago) that they don't print until the paper is advanced. Try adding a
few Carriage Return line feeds (CRLF - 0x0D 0x0A) to the end of the test
print, ie send:

0D 1B 42 0D 00 04 02 00 7D 00 03 30 31 32 33 34 35 30 0D 0A 0D 0A 0D 0A

>>What I have seen suggested here in the past is kbarcode. I don't know
>>how well it's maturing but it's probably worth a look. If you are able
>>to produce *any* code that produces reliable output from an ESC/P
>>printer I'd very much like to see it - as a starting point for my own
>>endeavours, especially seeing as I don't even know where to start with
>>this!

It is possible to print bar codes using the graphics mode (I used that
before we got a printer that could do bar codes, but I only had the
definitions for 2 of the possible bar codes).

JJ Jones

unread,
Nov 7, 2006, 10:07:11 AM11/7/06
to
Thanks. I've gotten it to basically work. But do you know how the
"bar length" works? I've tried all sorts of values for v1 and v2, but
the bar length never changes. I'm trying to make the bar length
shorter. Any ideas?

On Oct 26, 1:17 pm, Robert Newson <ReapNe...@bullet3.fsnet.oc.ku>
wrote:


> JJ Jones wrote:
> > Actually, ESC/P has been pretty reliable for simple things like
> > changing font sizes, etc. But I haven't gotten to first base on
> > barcodes or even graphics code. I would also like to use some simple

> > graphics, like blacking-out something with a solid black square.Thing with graphics is there are various "modes" which the printer may, or


> may not, understand, in particular 8 & 24 bit graphics (for 9 & 24 pin
> printers). The difference being that more bits are stacked vertically for
> the latter - 3 bytes are used to define the stack of bits to printer as
> opposed to just 8.
>
> When printing graphics, a stack of bits is scanned across each line - you
> need to specify /exactly/ how many stacks of bytes are being sent so that
> the printer with accept the full 8 bits for the next n bytes before resuming
> normal character/control interpretation.
>
> Similarly when doing bar codes: you will need to specify exactly how many
> data bytes are being sent to the command (the data for the bar code, plus
> the preamble which specifies the bar code type and size, etc).
>
> > One thing I found out is that there is a 1998 ESC/P manual which has a
> > somewhat different escape sequence for barcodes than the 1997 manual
> > that I have. For example, the 1997 manual shows the length as 2 bytes
> > - an int and a mod. While the 1998 manual shows it as a "word". I

> > assume a "word" is 4 bytes in this case.I would presume the word to be 16 bit, or 2 words, and giving the same result.


> ...
>
> >>I wish you well with this. We've an Epson thermal label/barcode printer
> >>which also uses ESC/P. I've never got further than having MS Word print
> >>to it from Win98. I'd like to get it printing barcodes though - I found

> >>the ESC/P manuals too baffling for my small brain.Examining the original example:

> >>this!It is possible to print bar codes using the graphics mode (I used that

john f archer

unread,
Dec 3, 2006, 5:39:19 AM12/3/06
to
First of all, you need to get the ANSI Standard for the barcode symbology
that you are using. Also you need to be very familiar with the manual for
printer and the barcode reader that you want to use. For simplicity, lets
assume that you are using Code 39 symbology and are using a dot matrix
printer. (Separate program is needed for an ink jet or laser printer since
it prints a page at a time while a dot matrix printer just prints a line at
a time. In DOS one can just send character zero or character 256 to the
printer in graphics mode to build the code 39 character out of blanks and a
black mark to build the characters that you need. However, there are
practical limits to the length of the line. Around 30 some odd characters
the printer goes crazy and doesn't print. At this point and for this line
length, simply add an addition null and this won't happen. Also, DON'T
program a dot matrix printer to double strike the barcodes to print NICE
DENSE BLACK BARCODE. The barcode thus produced usually can't be read simply
because the double striking reduces the white area and thus makes the
barcode unreadable. Also, remember that lowercase letters take up twice the
room of uppercase letters when printed as a barcode. (Take the letter A for
example: in upper case it is encoded as "A". However lower case "a" encoded
as "+A". Since two characters are necessary, the barcode is twice as wide.)
Also note that very long data strings can be split into several barcodes
that can be read into one field. This depends on the barcode reader. Please
read the manual. I have worked Worth Data barcode readers and I know they
have this capacity and work well. Other manufacturers would also work, I
just don't have any experience with them.

If you work in the Windows environment and use a barcode font, this might be
the simplest way; however, if you include have
a Windows barcode font this will work well except in an Adobe Acrobat
document. Adobe adds a little too much black to make a page more readable.
The last I knew the barcodes thus generated are not readable. I have raised
this point to Adobe representatives several times but have gotten a
response. I guess nobody at Adobe went to art school to know that the
negative space is just important as the positive space.

Sorry to take so much time. If you have other questions, Mr. Jones, please
email me so as not to bore the rest of the group. I will try to find my
FoxPro programs for producing barcodes.

Sincerely,
John F. Archer
(Publisher, Atavistic Press. ISBN: 0-915178)


"JJ Jones" <jamesjona...@yahoo.com> wrote in message
news:1161812634....@m7g2000cwm.googlegroups.com...

Arthur

unread,
Jun 21, 2007, 9:21:25 PM6/21/07
to

This awnser:

> <ESC> ( B [13] [0] [4] [2] [0] [125] [0] [3] 0 1 2 3 4 5 0
>
> We have (presuming data correct):
>
> <ESC> - command prefix
> ( - Command: an extended one, next char gives actual command
> B - Command: print a bar code
> [13][0] - A lo-hi (little-endian 16 bit word) length of data to
follow
> (13 bytes)
> [4] - Bar code type: 4 = UPC-E
> [2] - Module Width: 2 dots
> [0] - Space adjustment (none)
> [125][0] - A lo-hi Bar length = 125 units
> [3] - Control flag: 0000 0011 = No human readable chars
> Printer adds check digit
> 0..0 - Bar code data (7 as printer adds 8th check digit) - 0123450
>

That explanation its perfect, so comprehensive... but i think it didnt
work and i still have the doubt if it really works..
So, can i ask to you to give me a real sample... i mean "We have
(presuming data correct):" i guess that the data were wrong so i
cant print the codebar... so ... please can you give me a real sample
so i can be sure that it will work on my thermal printer??? better yet
if you show me how to print this
CI04006062026P517 on barcodes ... and the type of the barcode
"Code 39"... that should be the better for me and i really be thankful.
... thanks anyway....


--
Arthur
------------------------------------------------------------------------
Arthur's Profile: http://www.futurehardware.in/members/3996.htm
View this thread: http://www.futurehardware.in/547432.htm

http://www.futurehardware.in

0 new messages