Re: remote printer via Windows
On Thu, Mar 09, 2000 at 12:04:02PM +0200, Dan Pomohaci wrote:
> Hello,
>
> I have a Debian potato computer but the printer (HP Laserjet 6L) is
> conected to a Windows box.
> I instaled smbclient and Samba, and took the example from the doc
> (modified a litle). My printcap have this record:
> lp|remote-smbprinter:\
> :lp=/dev/null:sh:\
> :sd=/var/spool/lpd/hplj6l:\
> :if=/local/sbin/smbprint:
>
> Now I can print, but only text file.
> How can I print other type of files (dvi, ps, pdf etc.)? Where to put
> the filter for HP Laserjet?
I have modyfied smbprint - it's maybe outdatet (it's based on
samba-doc_1.9.18p10-7) and I don't know does it work now (I don't have
windows based printing service). It has extended config file (smbclient
options and optional filter - I use magicfilter).
My printcap emtry is:
p13|toshiba-pc-13_2:\
:lp=/dev/null:\
:sd=/var/spool/lpd/p13:\
:sh:pw#72:pl#66:px#1440:mx#0:\
:if=/usr/local/bin/smbprint:\
:af=/var/log/lp-acct:lf=/var/log/lp-errs:
I have two scripts (smbprint, get_option.bash) in /usr/local/bin/ and
.config file in spool directory.
I attached scripts and sample .config.
Mirek
#!/bin/sh -e
. /usr/local/bin/get_option.bash
# 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.
#
# 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`
spool_dir=`get_option -d "$@"`
config_file=$spool_dir/.config
# Should read the following variables set in the config file:
# server
# service
# password
# smboptions
# if_filter
eval `cat $config_file`
#
# Some debugging help, change the >> to > if you want to same space.
#
echo "server $server, service $service" >> $logfile
set -x
(
# NOTE You may wish to add the line `echo translate' if you want automatic
# CR/LF translation when printing.
# echo translate
echo "print -"
if [ -z "$if_filter" ] ; then
cat
else
$if_filter "$@"
fi
) | smbclient "\\\\$server\\$service" $password -N -P $smboptions >> /tmp/P13.log
#$logfile
function get_option ()
{
local P="$1"
local L=${#P}
local p
shift
while [ $# -gt 0 ] ; do
p="$1"
if [ "$P" = "${p:0:L}" ] ;then
echo "${p:L}"
break
fi
shift
done
}
server=MY_SERVER
service=Toshiba
password=PASSWORD
smboptions="-I 10.0.0.1"
if_filter=/usr/local/bin/ljet2p-filter.my.toshiba
Reply to: