[Samba] Pdf printer by mail with samba 3.0.9-1

Hamish lists at subvs.co.uk
Tue Dec 7 17:53:46 GMT 2004

Mitch (WebCob) wrote:

>-----Original Message-----
>>>Is anyone has set a samba mail pdf printer with ADS athentification ?
>>>can I setup samba for that ?
>Same as setting up samba for anything.  The "mail pdf printer" is just a 
>printer as far as Samba is concerned,  queing the job just happens to 
>invoke a script that does the ->pdf->mail thing rather than submitting it 
>to an actual print queue.
This is what I use, it is a simple script called from smb.conf. I have 
saved the script in /usr/bin and made it executable.

# Made by Hamish
# Simple script using ps2pdf to allow samba users to create pdf files
# invoke from samba print command = {this file} %s %U

# PDF will be saved directly to a samba share
# DATE is todays date
# OUTDIR is the full linux path to the directory to save the pdfs
# SAMBADIR is the path for windows clients
# FINALFILE is the name of the finished pdf
# MYDOMAIN is the mail domain to mail to
DATE=`date +%H%M%S-%d%m%y`

## Very basic logging
#echo "$USER executed smbpdfmaker" >> /tmp/pdflog.log
echo "Hi $USER, the PDF version of the file you just printed is located 
here: $SAMBADIR\\$FINALFILE It is only readable by you at the moment, so 
if you want others to be able to open it, save it outside the pdf 
folder, or email it. Please don't reply to this email. Always look twice 
before crossing a busy road. " | mail -s "Your PDF" -r IT@$MYDOMAIN 

Then I added this to my smb.conf

        comment = pdf printer
        path = /var/spool/samba
        printer admin = @domadm
        printable = Yes
        printing = lprng
        print command = /usr/bin/smbpdfmaker %s %U %m %I
        lpq command = lpq -P'%p'
        lprm command = lprm -P'%p' %j
        lppause command = lpc hold '%p' %j
        lpresume command = lpc release '%p' %j
        queuepause command = lpc stop '%p'
        queueresume command = lpc start '%p'
        printer name = pdfprinter
        oplocks = No
        share modes = No

Make sure the clients use a postscript driver (I think we used an HP 
colour laser PS driver, but there are lots that work just as well) - 
when they print to it, it mails them a link to the saved pdf (we were 
mailing pdfs directly, but this way was better because they would only 
save the file from the email anyway)

Hope that helps!

PS, of course, you should already have AD integration set up and a mail 
server with the same usernames!

More information about the samba mailing list