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

Re: lprng+samba+some_filter? (WAS: LPD network printing)



>The problem is that I cann't get these three things working together. What
>I did what set magicfilter as an input filter (if=whatever), and a shell
>script that calls samba_print <name?> as an output filter (of=whatever),
>but this doesn't work. In the printcap, lp is set to /dev/null, but
>there's nothing unusual.

I haven't yet tackled the .dvi thing (because I don't use DVI) but I have a
script that works with lpr and a shared windows printer via samba.  If you
can figure out a way to detect dvi files then I can't see any reason why it
wouldn't work.

Oh, the printer is a deskjet 500 (ie. non postscript and it now prints
postscript files perfectly so...)...

It works really well for me... good luck.

Adam.

-- printcap entry --

Samba HP 500|smb|lp:\
        :lp=/dev/null:sd=/var/spool/lpd/smb:\
        :sh:pw#80:pl#72:px#1440:mx#0:\
        :if=/usr/local/etc/smbprint:\
        :af=/var/spool/lpd/smb/acct:\
        :af=/var/log/lp-acct:lf=/var/log/lp-errs:

-- end printcap --

-- smbprint --

#!/bin/sh -x

eval acct_file=\$$#
spool_dir=`dirname $acct_file`
config_file=$spool_dir/.config

eval `cat $config_file`
echo "server $server, service $service" >> $logfile

IFS=''
read first_line
first_two_chars=`expr "$first_line" : '%!'`
if [ "$first_two_chars" = "2" ]; then # it's PostScript
  (
  echo "print -"
  /usr/bin/gs -dSAFER -dNOPAUSE -q -sPAPERSIZE=a4 -r300 -sDEVICE=djet500 \
	-sOutputFile=- -
  ) | /usr/bin/smbclient "\\\\$server\\$service" $password -U $server -N -P

else # it's plain text
  (
  # NOTE You may wish to add the line 
  #`echo translate' if you want automatic
  # CR/LF translation when printing.
                echo translate
                echo "print -"
                echo $first_line
                cat
                echo -e "\f"
  ) | /usr/bin/smbclient "\\\\$server\\$service" $password -U $server -N -P
fi

-- end smbprint --

-- .config --

# Name of the windows computer
server=scobie
# Name of the shared printer
service=pumper
# Password (in this case none)
password=""

-- end .config --


Reply to: