[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Remote printing



On Mon, Dec 14, 1998 mark.lake@ucl.ac.uk wrote (in part):
> 
> I'd like to print directly to a networked laser printer that has its
> own IP address.
> 

I print to an HP LaserJet 8000 N directly from Linux, both plain-text
files (lpr file-name) and graphics (using Netscape).  Since the printer
is IP addressable and PostScript ready, I don't need an intermediary
print server machine or any fancy filtering (except a hacked-together
banner page generator; see below).  The only "trick" in all this is
that filtering "if=" and remote printing "rm=" are mutually exclusive in
printcap, so I print locally to a spool (lp) that filters and redirects to
the "real" print spool (uswswdpt).  This is done in the same script that
adds the banner page.  There must be more elegant ways to do this, but
this has worked for me for a long time.  Be aware that this is specific to
my particular environment; e.g. the script that adds the banner adds TWO
page ejects because the printer is printing on both sides of the paper.

A final caveat: I set this up in my old Slackware days (I'm now running
hamm), so this may not be the good Debian way to go about things.

Below you will fine my /var/spool/lpd directory structure, the input
filter for creating a banner page, and the /etc/printcap file.

- MikeT

------------------------------------------------------------------------
$ ls -lR /var/spool/lpd
total 4
drwxrwxr-x   2 root     root         1024 Sep 16 10:42 ljet
drwxrwxr-x   2 root     bin          1024 Sep 16 10:42 ljet-if
drwxrwxr-x   2 lp       lp           1024 Sep 14 12:16 lp
drwxrwxr-x   2 lp       lp           1024 Jul 13 13:28 remote
/var/spool/lpd/ljet:
total 2
-rw-r-----   1 root     lp             20 Sep 16 10:42 lock
-rw-rw-r--   1 root     root           20 Sep 16 10:42 status
/var/spool/lpd/ljet-if:
total 3
-rwxr-xr-x   1 root     bin           321 Sep 14 12:20 input_filter
-rw-r--r--   1 root     root           20 Sep 16 10:42 lock
-rw-rw-r--   1 root     root           25 Sep 16 10:42 status
/var/spool/lpd/lp:
total 2
-rw-r--r--   1 root     root            5 Sep 13 06:47 lock
-rw-rw-r--   1 root     root           43 Sep 13 06:47 status
/var/spool/lpd/remote:
total 0
------------------------------------------------------------------------
$ cat /var/spool/lpd/ljet-if/input_filter
#!/bin/sh
tmpfile=/tmp/lpr$RANDOM
echo Host: $7 User: $5 Date: `date`  > $tmpfile
printf "\n"                          >> $tmpfile
/usr/games/banner -w35 $5 | head -57 >> $tmpfile
printf "\f\f"                        >> $tmpfile
cat                                  >> $tmpfile
lpr -Puswswdpt $tmpfile
rm $tmpfile
exit 0
------------------------------------------------------------------------
$ cat /etc/printcap
# /etc/printcap: printer capability database. See printcap(5).
# You can use the filter entries df, tf, cf, gf etc. for
# your own filters. See /etc/filter.ps, /etc/filter.pcl and
# the printcap(5) manual page for further details.
lp:\
	:lp=/dev/null:\
	:sd=/var/spool/lpd/ljet-if:\
	:if=/var/spool/lpd/ljet-if/input_filter:\
	:mx#0:\
	:sf:\
	:sh:
uswswdpt:\
	:lp=/dev/null:\
	:sd=/var/spool/lpd/ljet:\
	:rm=uswswdpt:rp=text:\
	:mx#0:\
	:sh:
------------------------------------------------------------------------
-- 
Michael E. Touloumtzis <toumi01@cai.com>


Reply to: