[Scottish] Printing to Windows

Colin McKinnon scottish at mailman.lug.org.uk
Fri Apr 25 12:48:00 2003


Hi all,

at the meet yesterday, someone (Iain?) was asking about printing to 
Windows attached printers. The easiest way to do it is to use a GUI tool 
too set it all up, the hard way is described below.

I modified the input filter for the printer to that below and wrote a 
wrapper around smbclient (NB there is no good reason in this context why 
the 2 scripts couldn't be merged)

HTH

Colin

---/var/spool/lpd/default/filter--------------------------
#!/bin/sh

# next 4 lines are specific to your printer -
DEVICE=ljet2p
RESOLUTION=300x300
PAPERSIZE=a4
SENDEOF=

# format raw text
enscript --lineprinter --landscape -Z -fCourier9 -M A4 -p- |
if [ "$DEVICE" = "PostScript" ]; then
        cat -
else
        gs -q -sDEVICE=$DEVICE \
                -r$RESOLUTION \
                -sPAPERSIZE=$PAPERSIZE \
                -dNOPAUSE \
                -dSAFER \
                -sOutputFile=- - | /usr/bin/wewsmbprint 
\\\\WindowsBox\\PrinterShare
fi

if [ "$SENDEOF" != "" ]; then
        printf "\004"
fi
---------/usr/bin/wewsmbprint---------------------------------
#!/bin/bash

(
echo "print -"
cat
) | /usr/bin/smbclient "$1" "" -P >/tmp/lastloprint.log