Problems with HP LaserJet 4m on SPARCstation 10

1 view
Skip to first unread message

Michael Bruns

Feb 12, 1993, 9:27:48 AM2/12/93

We have the following problem with a HP LaserJet 4m connected
on a SPARCstation 10 with SunOS 4.1.3 via serial and parallel
Centronics port by using lpr. The printcap entry for the
serial line is:

lp|hp|hplj|HP LaserJet4:\

When we use the printer for ASCII files it works fine but in the
case of PostScript files the LaserJet prints out the page but then
he reports an error: timeout.

Alternative we have tested the Centronics line with the printcap entry:

lp|hp|hplj|HP LaserJet4:\

Again, the page comes out with the same timeout error for PostScript
files and on ASCII files it produces only an empty page. Additional,
the command

cat postscript.file > /dev/bpp0

results in the same postscript printer error.

Is there anyone who can help with printcap entries or some ideas?

Michael Bruns
Max-Planck-Institut fuer Aeronomie
D-3411 Katlenburg-Lindau
Internet: (


Jack Stewart

Feb 15, 1993, 7:18:13 PM2/15/93
I had a very similar problem with the LaserJet 4m but after the
manuals arrived for the LaserJet 4m I was able to piece the solution

The LaserJet 4m expect a ^D at the end of every postscript file.
Otherwise it will wait for input and after 40 seconds or so, send an
"Error TIMEOUT" message. But that isn't the only problem, once you
have put a ^D at the end of the postscript file, the printer is left
in postscript mode for ~15 seconds. Thus if you send a postscript
file followed by a ascii file, you will also get error messages.

The solution from the HP manuals is to send a PCL command call
Universal Exit Language at the begining and end of every print job.
The Universal Exit Language code is "<ESC>%-12345X". The rational
behind this convoluted approach is that the HP LaserJet 4M has an auto
personality (that is it can automatically switch between postscript
and PCL [ascii]).

I wrote my own filter in perl. It should probably be rewritten in C
but I haven't had the time. I have put an abridged version of the
script at the end of this message. It is also available via anonymous
ftp in pub/ from In order for my
filter program to work I needed to set the ":sb:" option in

I would strongly recommend that anyone with a LaserJet 4M get the full
set of manuals from HP. These printers are capable of many wierd and
wonderful things (such as paper tray selection from within postscript).


Jack Stewart E-Mail: ja...@CCSF.Caltech.EDU
Caltech Concurrent Supercomputing Facilities, Phone: 818-356-2153
Mail Code # 158-79, 391 S. Holliston,
Pasadena, CA 91125. #include <std.disclaimer>

Here is the printcap entry:
# HP LJ IV attached to an XCD Xconnect box
# and served with RTEL software
Borg|borg|ljiv|hp|RTELD printer:\
Here is the perl script
open(IN,"-") || die "Can't find STDIN\n";
open(OUT,">-") || die "Can't open STDOUT\n";

print OUT "\033%-12345X\n"; # UEL - Start with a Fresh Printer

if ($firstline =~ /^(\w+):(\w+)\s+Job:\s+([\w,-,.,=,_]+)\s+Date:\s+(.+)/ )
print OUT "\n\n\n\n\n\n\n";
print OUT " Put Your Own Banner Here!!!";
print OUT "\n\n\n\n\n\n\n";
print OUT " For: $2\n";
print OUT " Host: $1\n";
print OUT " Job: $3\n";
print OUT " Date: "$4\n";
print OUT "\n\n\n";
else {
if ($firstline =~ /^%!/) {
print OUT $firstline,"\n";

while (<IN>) {
if (/^\f%!/) {
if ($append eq "true") {
print OUT "\cD\n";
} else { print OUT "\f";}
print OUT "\033%-12345X\n";
print OUT "%!",$',"\n";
if (/^\f/) {
if ($append eq "true") {
print OUT "\cD\n";
} else { print OUT "\f";}
print OUT "\033%-12345X\n";
$append="false"; # Not Postscript
print OUT $',"\n";
print OUT $_,"\n";

# File has been written out.
# Now Close it cleanly
if ($append eq "true") {
print OUT "\cD\n";
} else { print OUT "\f"; }

print OUT "\033%-12345X\n"; # UEL - End with a Fresh Printer

That's all there is too it.

Reply all
Reply to author
0 new messages