Sending print codes to a printer

Kanwar Ranbir Sandhu m3freak at rogers.com
Fri Nov 25 01:10:50 UTC 2005


Hello Everyone,

I've posted a similar request to the Okidata mail list at
linuxprinting.org, but have not received a reply.  I'm hoping someone
here can give me a little insight.

Has anyone here ever tried sending printer codes (i.e. ESC/P and/or
ESC/P2) directly to a printer?  I'm having problems with one code.

I have an Okidata ML395 attached to a Fedora Core 4 CUPS server, via the
parallel port.  I'm trying to tell the printer to switch fonts from
Roman (default) to Gothic.  This is the ASCII format of the command:

ESC k n

where 'n' equals the number of the font selection.  The choices are 0,
1, 2, 3, 7, 122, 124 and 126.  Gothic is 124, so this is what I'm
trying:

echo -e '\ek124' > /dev/lp0

The menu panel on the printer should show that the font has changed.
Instead, the printer interprets the first three characters as the whole
command, which in this case means select the Swiss font, and then prints
out '24' using that font.  That is, the print accepts '\ek1' as the
print code instead of '\ek124'.

Other print codes have worked, but they've been at most 5 characters
(backslash included).  As soon as a sixth ASCII character is added, it
isn't interpreted, and causes the entire print code to be mangled.

I could avoid all of this if I used a driver, but the software that
prints to the Okidata doesn't let you choose the font, paper size, etc.,
for the document you're printing (can't change it...it's proprietary,
and is mission critical).  So, a simple custom filter script and a RAW
print queue is necessary.

I assume I'm not specifying the print code properly.  I've tried double
quotes instead of the single quotes, but they don't change anything.  Is
there a way to specify the print code such that the printer will
interpret the entire ASCII command?

This obviously is completely off-topic, though I do have a FC4 server
involved. :)

Any tips appreciated.

Regards,

Ranbir
-- 
Kanwar Ranbir Sandhu
Systems Aligned Inc.
www.systemsaligned.com




More information about the users mailing list