Printing from Linux -> NT with banners

Wed May 5 08:01:27 GMT 1999

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:


while getopts cw:l:i:n:h: flag; do
  case $flag in
    (n) printuid=$OPTARG ;;
    (h) printhost=$OPTARG ;;

cat | 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>) |

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.


John Hartnup, IGNAS IEFTP Team
IBM Warwick
IBM - 664926 -- External  - (01926) 464926

More information about the samba mailing list