Sending escape codes to printer ???

Sending escape codes to printer ???

Post by THE TIME LO » Thu, 25 Jun 1992 14:09:23



How you can send escape codes to the printer ??
I am using a Desk Jet Plus and I try to send escape
characters using: echo ^[k2G > /dev/lp1 ( ^[ are two
characters ^ and [ ) but I dont'd think that it works
since it just print the string .
I am using linux 0.96b patchlevel 1.

Thank you in advance,
Harry Georgopoulos

 
 
 

Sending escape codes to printer ???

Post by Drew Eckhar » Fri, 26 Jun 1992 03:26:29



Quote:>How you can send escape codes to the printer ??
>I am using a Desk Jet Plus and I try to send escape
>characters using: echo ^[k2G > /dev/lp1 ( ^[ are two
>characters ^ and [ ) but I dont'd think that it works
>since it just print the string .
>I am using linux 0.96b patchlevel 1.

^ and [ are two characters, so it doesn't work.  Use control V
to escape the escape - ie on your keyboard, type

control - v followed by escape.

Also, you might want to use

echo -n

So that no new line is printed.

 
 
 

Sending escape codes to printer ???

Post by Douglas E. Qua » Fri, 26 Jun 1992 09:19:04



Quote:>How you can send escape codes to the printer ??

The preferred method of sending escape codes is to use printf(1) which can
be found in the GNU utils.  Unfortunately the latest release has a couple
of little bugs that cause it to mess up hex and octal escapes.  I sent a
fix to gnu.utils.bug and they will probably include a better fix in the
next release.  With a fixed printf your example would look like

printf '\x1b&k2G' >/dev/lp

With a broken printf the \x1b would have to be replaced by a literal escape.

--
Doug Quale

 
 
 

Sending escape codes to printer ???

Post by Timothy L. Nal » Fri, 26 Jun 1992 14:50:19


Excerpts from netnews.comp.os.linux: 24-Jun-92 Sending escape codes to

Quote:>How you can send escape codes to the printer ??
>I am using a Desk Jet Plus and I try to send escape
>characters using: echo ^[k2G > /dev/lp1 ( ^[ are two
>characters ^ and [ ) but I dont'd think that it works
>since it just print the string .

I wish it were that easy :)

you have to echo the hex values for those characters to the printer.
This should work, I think.

echo '\0x1b\0x26\0x6b\0x32\0x47' > /dev/lp1
or just
echo '\0x1b'&k2G > /dev/lp1

_____________________________________________________________________________

 Tim Nali            \  "We are the music makers, and we are the dreamers of

 
 
 

Sending escape codes to printer ???

Post by Al Cla » Sat, 27 Jun 1992 04:55:42



Quote:>How you can send escape codes to the printer ??
>I am using a Desk Jet Plus and I try to send escape
>characters using: echo ^[k2G > /dev/lp1 ( ^[ are two
>characters ^ and [ ) but I dont'd think that it works
>since it just print the string .
>I am using linux 0.96b patchlevel 1.

>Thank you in advance,
>Harry Georgopoulos

This is a shell character entry issue.
You have to enter the sequence Control-V Escape to enter Escape on the
command line. It will print as C-[ since Escape is actually Control-[
--

      *** Practice random kindness and senseless acts of beauty! ***
 
 
 

Sending escape codes to printer ???

Post by Jim Bur » Sat, 27 Jun 1992 15:13:07



Quote:> How you can send escape codes to the printer ??
> I am using a Desk Jet Plus and I try to send escape
> characters using: echo ^[k2G > /dev/lp1 ( ^[ are two
> characters ^ and [ ) but I dont'd think that it works
> since it just print the string .

This is my lpinit script for bash:

echo -ne '\033&k2G' >/dev/lp2

The -n suppresses the linefeed, and the -e allows octal escapes.
--
BURNS,JIM (returned student)
Georgia Institute of Technology, 30178 Georgia Tech Station,

uucp:     ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a

 
 
 

Sending escape codes to printer ???

Post by Martin Muell » Sun, 28 Jun 1992 05:19:17



: How you can send escape codes to the printer ??
: I am using a Desk Jet Plus and I try to send escape
: characters using: echo ^[k2G > /dev/lp1 ( ^[ are two
: characters ^ and [ ) but I dont'd think that it works
: since it just print the string .
: I am using linux 0.96b patchlevel 1.
:
: Thank you in advance,
: Harry Georgopoulos

HERE'S THE SOLUTION:
type 'cat > prtinit'
press RETURN
press ESC-key
type 'k2G'
press CRTL-D
press RETURN
type 'cat prtinit >/dev/lp1'       (You can put this line in your /etc/rc)

Have a nice printing

mfG


|| \\  // || || \\  // ||   Martin Mueller, Lichtenrader Str.22  | LINUX...
||  \\//  || ||  \\//  ||  1000 Berlin 44  | Tel: +49 30 6216879 | THE one
||        || ||        ||   ___________________________________  | and ONLY!!
||        || ||        ||   | Diese Flaeche ist zu vermieten! |  |
--

mfG


|| \\  // || || \\  // ||   Martin Mueller, Lichtenrader Str.22  | LINUX...
||  \\//  || ||  \\//  ||  1000 Berlin 44  | Tel: +49 30 6216879 | THE one
||        || ||        ||   ___________________________________  | and ONLY!!

 
 
 

1. Sending Octal Escape codes to printer

Hi all:
A few weeks ago I posted the following to comp.unix.shell and got exactly
zero answers. I don't particularly like to see wads of cross-postings on
questions, and don't flame me about posting to the wrong group. They didn't
answer - at least I didn't see any responses.
--
How does one go about echoing two cat'ed codes to the printer? Specifically
I'm trying to setup an alternative "interface" script for a printer. This
printer has, as a default, the programmable switch-setting set for no-print
over perforation. This can be re-set, either manually, or by echoing the
appropriate code to the printer. Unfortunately, this requires two codes in
the familiar escape sequence. Escape + "N" to set it, and Escape + "O" to
re-set it.

/bin/sh

One code is trivial      -  echo "\014\c" ( for form-feed )

We'd like to send Escape + "N" i.e. [ echo "\033\c\096\c" ] doesn't work
We'd like to send Escape + "O" i.e. [ echo "\033\c\097\c" ] doesn't work

What's the trick ?
--


Lomas Data Management Inc.       | Has anyone noticed that DOS is SOD spelled |
Niagara Falls, Ontario Canada    | backwards as in the British "Sod-off" ?    |
#      Any opinions expressed are those of my previous employer
--
David Lomas

2. Always Technology SCSI-2 AL-708 multifunction card device drivers

3. Promblem sending printer codes to printer

4. M$-Rant(tm) v1.2.13 About Slirp.

5. Sending escape sequences to a dot matirx printer

6. cluster question

7. Send escape characters to a printer

8. 2.5.52

9. Sending escape characters to the printer

10. How to send escape sequence to a printer ?

11. Sending ESCAPE SEQUENCESto a printer

12. Printer Escape codes

13. Linux eating Escape Codes for printer