[cups.general] Cups PDF Pinter

Jerome Alet alet at librelogiciel.com
Wed Mar 26 06:08:09 PDT 2008


On Tue, Mar 25, 2008 at 06:43:06PM -0700, shayro wrote:
> I like to ask if someone now how if i already have a cup pdf 
> printer, how y get the pdf send to a sahre folder create automatic 
> whit the name of the user that send the print document , i read that 
> the user must to be o must to have a home user in the server , but i 
> need to read that parameter from ldap i canot have every user in the 
> lan , in this server y need cups read this parameter from the ldap 
> server and generate a share to store the document create, someone 
> have any idea , link etc..? 

Not exactly what you want, but anyway, using Tea4CUPS 
(from http://www.pykota.com/software/) you could create a
PDF to email software in minutes :

/etc/cups/ipemail :
--- CUT ---
localhost:me at example.com
127.0.0.1:me at example.com
192.168.1.1:someoneelse at example.com
192.168.1.25:myaccount at gmail.com
--- CUT ---

/etc/cups/tea4cups.conf :
--- CUT ---
[global]
debug : no
directory : /var/spool/tea4cups/
keepfiles : no

[PDFGen]
prehook_topdf : /usr/local/bin/pdftomail.sh
--- CUT ---

/usr/local/bin/pdftomail.sh :
--- CUT ---
#! /bin/sh
#
USEREMAIL=`ldapsearch -x \
                      -H ldap://directory.example.com \
                      -b "ou=people,ou=example,ou=com" \
                      "uid=$TEAUSERNAME" \
             | grep "^mail: " \
             | cut -f 2,2 -d " "`

if [ -z "$USEREMAIL" ] ; then
  USEREMAIL=`grep "^$TEACLIENTHOST" /etc/cups/ipemail | cut -f 2,2 -d :` ;
fi
if [ -n "$USEREMAIL" ] ; then
  PDFFILE="/tmp/$TEAUSERNAME-$TEAJOBID.pdf"
  ps2pdf - <"$TEADATAFILE" >"$PDFFILE" \
  && mpack -c application/pdf \
           -s "Fichier PDF $TEAUSERNAME (#$TEAJOBID)" \
           "$PDFFILE" \
           "$USEREMAIL" \
  && rm -f "/tmp/$TEAUSERNAME-$TEAJOBID.pdf" ;
fi
--- CUT ---

Result of 'lpstat -v' :
--- CUT ---
device for PDFGen: tea4cups://
--- CUT ---

All documents printed to the PDFGen printer (you must use a PostScript
driver) are converted to PDF and emailed back to the end user.

If the username's email address can't be found in the LDAP
server, then a static IP-to-emailAddress file is parsed to search
for the client host's IP address, and use the corresponding
email address.

Hoping this answers at least partially to your question.

It's easy with this to do something else I think.

bye

Jerome Alet





More information about the cups mailing list