Date: Fri, 10 Jul 1998 17:17:16 -0700 (PDT) From: Thomas Dean <tomdean@ix.netcom.com> To: raul@hounsfield.gdl.iteso.mx Cc: FreeBSD-questions@FreeBSD.ORG Subject: Re: LaserJet IIIP with a Postscipt cartridge Message-ID: <199807110017.RAA01479@ix.netcom.com> In-Reply-To: <199807101917.NAA07087@roentgen.org.mx> (raul@hounsfield.gdl.iteso.mx)
next in thread | previous in thread | raw e-mail | index | archive | help
I have a LaserJet III. But, this should work.
I use a file, /var/spool/lpd/current_language* to keep track of the
printer mode. This file is initially setup in rc.local
There is a file that needs to be created to send to the printer to
select the ps cartridge. This file is mostly '\000'. For some reason
that I have not looked into, the printer seems to need time between
the first characters and the language change command. It is on my
list of interesting things. Not very high... What I have seems to
work, so, I don't fool with it.
#
# site-specific startup actions, daemons
#
# $Id: rc.local,v 1.21 1996/10/24 09:43:59 scrappy Exp $
#
#<snip>
# put your local stuff here
echo -n "Cleanup printer state, "
# clean up the printer state
# cleanup postsciprt, if it exists
if [ -f /var/spool/lpd/current_language.postscript ]; then
rm -f /var/spool/lpd/current_language.postscript
fi
# set pcl, if it doesn't exist
if [ ! -f /var/spool/lpd/current_language.pcl ]; then
touch /var/spool/lpd/current_language.pcl
fi
echo -n "current-language owner and group, "
chown daemon /var/spool/lpd/current_language.pcl
chgrp bin /var/spool/lpd/current_language.pcl
echo "/var/spool/lpd owner. "
chown daemon /var/spool/lpd
chgrp bin /var/spool/lpd
# <snip>
===================
# @(#)printcap 5.3 (Berkeley) 6/30/90
# $Id: printcap,v 1.5 1996/10/13 16:52:33 joerg Exp $
lp|pcl|Pcl Line Printer:\
:lp=/dev/lpt0:\
:sh:\
:if=/etc/HPLaserjet/PclFilter:\
:lf=/var/spool/lpd/lp/log:\
:sd=/var/spool/lpd/lp:
ps|postscript|Postscript Line Printer:\
:lp=/dev/lpt0:\
:sh:\
:if=/etc/HPLaserjet/PsFilter:\
:lf=/var/spool/lpd/ps/log:\
:sd=/var/spool/lpd/ps:
env|Envelope Line Printer:\
:lp=/dev/lpt0:\
:sh:\
:if=/etc/HPLaserjet/EnvFilter:\
:lf=/var/spool/lpd/env/log:\
:sd=/var/spool/lpd/env:
====== /etc/HPLaserjet/PclFilter
#!/bin/sh
#
# /etc/HPLaserjet/PclFilter
# simple if filter for hp laserjet
#
# switch to pcl, if necessary
#
# 970704 tomdean
#
# cleanup postsciprt, if it exists
if [ -f /var/spool/lpd/current_language.postscript ]; then
/bin/cat /etc/HPLaserjet/toPcl.ascii
/bin/rm -f /var/spool/lpd/current_language.postscript
/usr/bin/touch /var/spool/lpd/current_language.pcl
fi
# set pcl, if it doesn't exist
if [ ! -f /var/spool/lpd/current_language.pcl ]; then
/bin/cat /etc/HPLaserjet/toPcl.ascii
/usr/bin/touch /var/spool/lpd/current_language.pcl
fi
# now, print the file
printf "\033&k2G" && cat && printf "\f" && exit 0
exit 2
====== /etc/HPLaserjet/PsFilter
#!/bin/sh
#
# /etc/HPLaserjet/PsFilter
# simple if filter for hp laserjet
#
# switch to postscript, if necessary
#
# 970704 tomdean
#
# cleanup the pcl tag, if it exists.
if [ -f /var/spool/lpd/current_language.pcl ]; then
cat /etc/HPLaserjet/toPostscript.ascii
rm -f /var/spool/lpd/current_language.pcl
touch /var/spool/lpd/current_language.postscript
fi
#set postscript
if [ ! -f /var/spool/lpd/current_language.postscript ]; then
cat /etc/HPLaserjet/toPostscript.ascii
touch /var/spool/lpd/current_language.postscript
fi
# now, print the file
cat && exit 0
exit 2
====== /etc/HPLaserjet/EnvFilter#!/bin/sh
#
# /etc/HPLaserjet/EnvFilter
# simple if filter for hp laserjet to print envelopes
#
# needs some error detection. For now, always returns 0
# if there are any printing errors, should return 2
#
# switch to pcl, if necessary
#
# 970704 tomdean
#
# cleanup postscript, if it exists
if [ -f /var/spool/lpd/current_language.postscript ]; then
cat /etc/HPLaserjet/toPcl.ascii
rm -f /var/spool/lpd/current_language.postscript
touch /var/spool/lpd/current_language.pcl
fi
# set pcl, if it doesn't exist
if [ ! -f /var/spool/lpd/current_language.pcl ]; then
cat /etc/HPLaserjet/toPcl.ascii
touch /var/spool/lpd/current_language.pcl
fi
#################################
# define some useful things
esc='\033'
roman8='(8U'
fixed='(s0p'
pitch10='10.00h'
pitch12='12.00h'
point10='10.0v'
point12='12.0v'
upright='0s'
medium='0b'
bold='3b'
courier='3T'
crIsCrLf='&k2G'
envCom10='&l81a'
manualFeedEnv='&l3h'
letter='&l2A'
paperTrayAuto='&l1h'
portrait='&l0O'
landscape='&l1O'
# set line end behavior
printf "$esc$crIsCrLf"
# set envelope and return address font - print the return address
printf "$esc$roman8$esc$fixed$pitch10$point12$upright$medium$courier"
printf "$esc$envCom10$manualFeedEnv$landscape"
numColumns='0'
numLines='0'
topMargin="&l0E" # "&l${numLines}E"
leftMargin="&a0L" # "&a${numColumns}L"
printf "$esc$topMargin$esc$leftMargin"
if [ -r /etc/HPLaserjet/return_address ]; then
cat /etc/HPLaserjet/return_address
else
printf "Thomas and Fueno Dean\n";
printf "8487 Bessie Place, NW\n";
printf "Silverdale, WA 98383-8837\n";
fi
# set the to address margins and print it
numColumns='45'
leftMargin="&a${numColumns}L"
printf "$esc$leftMargin"
printf '\n\n\n\n\n\n';
printf "$esc$roman8$esc$fixed$pitch10$point12$upright$bold$courier"
# print the addressee's address
cat
# restore defaults
printf "$esc$letter$esc$paperTrayAuto$portrait"
printf "$esc$roman8$esc$fixed$pitch10$point12$upright$medium$courier"
numColumns='0'
numLines='0'
topMargin="&/${numLines}E"
leftMargin="&a${numColumns}L"
printf "$esc$topMargin$esc$leftMargin"
exit 0
exit 2
===== hd /etc/HPLaserjet/toPcl.ascii
00000000 1b 25 2d 31 32 33 34 35 58 00 00 00 00 00 00 00 |.%-12345X.......|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00002400 00 00 00 00 00 00 00 00 00 1b 25 2d 31 32 33 34 |..........%-1234|
00002410 35 58 40 50 4a 4c 20 45 4e 54 45 52 20 4c 41 4e |5X@PJL ENTER LAN|
00002420 47 55 41 47 45 20 3d 20 50 43 4c 0d 0a 00 00 00 |GUAGE = PCL.....|
00002430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00002490
===== hd /etc/HPLaserjet/toPostscript.ascii
00000000 1b 25 2d 31 32 33 34 35 58 00 00 00 00 00 00 00 |.%-12345X.......|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00002400 00 00 00 00 00 00 00 00 00 1b 25 2d 31 32 33 34 |..........%-1234|
00002410 35 58 40 50 4a 4c 20 45 4e 54 45 52 20 4c 41 4e |5X@PJL ENTER LAN|
00002420 47 55 41 47 45 20 3d 20 50 4f 53 54 53 43 52 49 |GUAGE = POSTSCRI|
00002430 50 54 0d 0a 00 00 00 00 00 00 00 00 00 00 00 00 |PT..............|
00002440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00002490
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807110017.RAA01479>
