Re: impressao smb
Celso Andrade escreveu:
> por favor, alguem possui uma impressora matricial ligada em estação
> win e que esteja conseguindo imprimir a partir do linux? Já li o
> samba howto e não consegui. Na 'família red hat' eu usava o printtool
> e funcionava legal. No debian não achei algo semelhante. Usei o
> magicfilter para configurar minha jato local, mas a do win nao
> consigo.
> Se alguem possuir configuracão semelhante se puder enviar seu
> printcap pra mim agradeceria. Estou ficando louco com a impressora,
> pena que não posso colocar linux na outra máquina, seria mais fácil :)
Pelo pouco que sei, você precisa ter os "drivers" da impressora onde
você quer imprimir. O magicfilter (através do gs) vem com diversos
scripts para diversas impressoras e gera um arquivo que pode ser
mandado diretamente para a impressora.
Você conseguirá saber os drivers suportados pelo gs, digitando:
--
bash$ gs
GNU Ghostscript 5.50 (2000-2-13)
Copyright (C) 1998 Aladdin Enterprises, Menlo Park, CA. All rights reserved.
This software comes with NO WARRANTY: see the file COPYING for details.
GS>devicenames ==
--
Eu não lembro como se fazem as alterações no printcap, pois fiz isso
há muito tempo e não uso mais o printcap.
Como eu uso uma impressora PS, mando o código PS diretamente para
ela usando o smbclient. Há um script chamado smbprint que manda o
arquivo gerado pelo magicfilter ou, no meu caso, o PS para a
impressora.
Mando os arquivos usados pelo smbprint abaixo (eu os deixei no meu
~/bin/):
-------- smbprint --------
#!/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.
#
# 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:
# share=PC_SERVER
# user="user"
# password="password"
#
# Please, do not modify the order in the file.
# Example:
# share=\\server\deskjet
# user="fred"
# password=""
#
# 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
config_file=~/bin/.config
# Should read the following variables set in the config file:
# share
# hostip
# user
# password
eval `cat $config_file`
share=`echo $share | sed "s/[\]/\//g"`
if [ "$user" != "" ]; then
usercmd="-U"
else
usercmd=""
fi
if [ "$workgroup" != "" ]; then
workgroupcmd="-W"
else
workgroupcmd=""
fi
if [ "$translate" = "yes" ]; then
command="translate ; print -"
else
command="print -"
fi
echo $share $password $translate $command $1
cat $1 | /usr/bin/smbclient "$share" "$password" -E ${hostip:+-I} \
$hostip -N -P $usercmd "$user" $workgroupcmd "$workgroup" \
-c "$command"
-------- .config --------
share=//PRINTSERVER/hpps
hostip=192.168.0.1
workgroup=PRINT
user="fg"
password="senha"
--------
Fábio
--
If you resist reading what you disagree with, how will you ever acquire
deeper insights into what you believe? The things most worth reading
are precisely those that challenge our convictions.
#!/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.
#
# 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:
# share=PC_SERVER
# user="user"
# password="password"
#
# Please, do not modify the order in the file.
# Example:
# share=\\server\deskjet
# user="fred"
# password=""
#
# 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
config_file=~/bin/.config
# Should read the following variables set in the config file:
# share
# hostip
# user
# password
eval `cat $config_file`
share=`echo $share | sed "s/[\]/\//g"`
if [ "$user" != "" ]; then
usercmd="-U"
else
usercmd=""
fi
if [ "$workgroup" != "" ]; then
workgroupcmd="-W"
else
workgroupcmd=""
fi
if [ "$translate" = "yes" ]; then
command="translate ; print -"
else
command="print -"
fi
echo $share $password $translate $command $1
cat $1 | /usr/bin/smbclient "$share" "$password" -E ${hostip:+-I} \
$hostip -N -P $usercmd "$user" $workgroupcmd "$workgroup" \
-c "$command"
Reply to: