Printing from Linux -> NT with banners

Stephen L Arnold arnold.steve at ensco.com
Thu May 6 00:15:25 GMT 1999


When the world was young, HARTNUJ at uk.ibm.com carved some runes like this:

> Last week I sent a question here about suppressing NT's banners, so that a
> LPR->SMB gateway running on Linux could provide its own banner pages. I
> got around that problem by having the NT guys create me a new queue, with
> headers suppressed, but found to my surprise that merely omitting "sh" in
> /etc/printcap did not cause Linux to print header sheets, when using
> RedHat's smbprint machanism (which is only slightly modified from the
> stock Samba smbprint).
> 
> So for your edification, here's the deal, as far as I can see.
> 
> /etc/printcap states that the input filter is foo, and that the print
> device is /dev/null This is because lpr doesn't actually do any printing.
> smbprint is called from somewhere within foo. Lpd gratiously sends its
> banner to /dev/null, then sends the print job through foo (bye-bye
> banner).
> 
> So, my solution was to hack the filter to prepend a banner to any output
> it produces. Since my printer is postscript, that's what I produced:
> 
> BANNER=/tmp/lprbanner$$
> 
> while getopts cw:l:i:n:h: flag; do
>   case $flag in
>     (n) printuid=$OPTARG ;;
>     (h) printhost=$OPTARG ;;
>   esac
> done
> 
> cat template.ps | sed -e "s/_USERNAME_/$printuid/
>                           s/_HOSTNAME_/$printhost/" > $BANNER
> 
> then later in the script:
> 
> (cat $BANNER; <other commands to produce PS output from print job>) |
> smbprint
> 
> Template.PS is a template banner, which can be as flashy as you like (mine
> has Tux in the corner)
> 
> Hope this is useful; apologies if it's old hat; and please let me know if
> there's a "saner" way.

I'm not sure if it's actually "saner" but wouldn't the standard way 
be to setup 2 printcap entries where the first one applies the 
banner and then redirects to a second queue that sends the job out?

That's what I did for our old Netware queue (linux uses the ncpfs 
util nprint to send the jobs out to the Netware queue) as described 
in the linux printing HOWTO.

At least that way you're not hacking the print filter, but creating 
your own custom filter (let me know if you want one that formats 
text via PCL5 escape codes).  Probably doesn't matter anyway...

Steve


****************************************************************
Stephen L. Arnold                        Senior Systems Engineer
ENSCO Inc.                        email:  arnold.steve at ensco.com
P.O. Box 5488                         www:  http://www.ensco.com
Vandenberg AFB, CA  93437                    voice: 805.606.8838
                                               fax: 805.734.4779
#include <std_disclaimer.h>
****************************************************************


More information about the samba mailing list