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

Re: PCL 5 and Magicfilter



On Fri, Aug 20, 1999 at 05:19:47PM -0700, Lazar Fleysher wrote:
> Hi Everybody,
> 
> I have a Winprinter :( and it can simulate PCL5 with 600dpi resolution.
> The printer is connected to a win machine and I use samba to print to it.
> The question is which device should I use for magic filter configuration?
> Currently, I have set up the filter to use laserjet (which is, I think,
> PCL2 with 300 dpi).Definitely, it is not 600dpi.
> 

Setup magic filter for laserjet, acting as if it is a local printer.

Then, add a script called /etc/magicfilter/samba-ljet3-remote with this in it:
#!/bin/sh
/etc/magicfilter/ljet3-filter | /usr/local/sbin/smbprint $*

Make sure it is executable.

Next, add the attached smbprint script to /usr/local/sbin. Make sure it
is executable. It is from /usr/doc/samba-doc/examples/examples/printing.

magicfilterconfig should have made a spool directory for your printer
called something like '/var/spool/lpd/hplj3'. Add a .config file in that
directory with lines like this:
server=kennedy
service=hplj
password=foobar

Finally, Add a printcap entry like this:
lp|hplj3|HP Laserjet III:\
	:lp=/dev/hplj3:sd=/var/spool/lpd/hplj3:\
	:sh:pw#80:pl#66:px#1440:mx#0:\
	:if=/etc/magicfilter/samba-ljet3-filter:\
	:af=/var/spool/lpd/hplj3/acct:lf=/var/log/lp-errs:

Restart lpd (or lprng..it seems to be better and not die randomly on me)
and everything should work! 
-- 
Stephen Pitts
smpitts@midsouth.rr.com
webmaster - http://www.mschess.org
#!/bin/sh 

# This script is an input filter for printcap printing on a unix machine. It
# uses the smbclient program to print the file to the specified smb-based 
# server and service.
# For example you could have a printcap entry like this
#
# smb:lp=/dev/null:sd=/usr/spool/smb:sh:if=/usr/local/samba/smbprint
#
# which would create a unix printer called "smb" that will print via this 
# script. You will need to create the spool directory /usr/spool/smb with
# appropriate permissions and ownerships for your system.

# Set these to the server and service you wish to print to 
# In this example I have a WfWg PC called "lapland" that has a printer 
# exported called "printer" with no password.

#
# Script further altered by hamiltom@ecnz.co.nz (Michael Hamilton)
# so that the server, service, and password can be read from 
# a /usr/var/spool/lpd/PRINTNAME/.config file.
#
# Script further modified by Richard Sharpe to fix some things.
# Get rid of the -x on the first line, and add parameters
#
#    -t  now causes translate to be used when sending files
#
# In order for this to work the /etc/printcap entry must include an 
# accounting file (af=...):
#
#   cdcolour:\
#	:cm=CD IBM Colorjet on 6th:\
#	:sd=/var/spool/lpd/cdcolour:\
#	:af=/var/spool/lpd/cdcolour/acct:\
#	:if=/usr/local/etc/smbprint:\
#	:mx=0:\
#	:lp=/dev/null:
#
# The /usr/var/spool/lpd/PRINTNAME/.config file should contain:
#   server=PC_SERVER
#   service=PR_SHARENAME
#   password="password"
#
# E.g.
#   server=PAULS_PC
#   service=CJET_371
#   password=""

#
# Debugging log file, change to /dev/null if you like.
#
logfile=/tmp/smb-print.log
# logfile=/dev/null


#
# The last parameter to the filter is the accounting file name.
#   Extract the directory name from the file name.
#   Concat this with /.config to get the config file.
#
eval acct_file=\${$#}
spool_dir=`dirname $acct_file` 
config_file=$spool_dir/.config

# Should read the following variables set in the config file:
#   server
#   service
#   password
eval `cat $config_file`

#
# Some debugging help, change the >> to > if you want to same space.
#
echo "server $server, service $service, file $acct_file" >> $logfile

(
        echo translate
	echo "print -"
	cat
) | /usr/bin/smbclient "\\\\$server\\$service" $password -U $server -N -P >> $logfile

Reply to: