Penguin
Blame: SambaPDFPrinter
EditPageHistoryDiffInfoLikePages
Annotated edit history of SambaPDFPrinter version 8, including all changes. View license author blame.
Rev Author # Line
1 GreigMcGill 1 !!A Samba Printer that will Email you a PDF.
2
8 CraigBox 3 OK, just initial notes. This has been implemented on RedHat and Debian (as that's what we use - sorry guys!), and uses LPRng. See [CUPSNotes] for a [CUPS] version of this system.
1 GreigMcGill 4
5 First, I defined a queue in printcap like so:
6
8 CraigBox 7 <verbatim>
1 GreigMcGill 8 pdfwriter:\
9 :ml#0:\
10 :mx#0:\
11 :sd=/var/spool/lpd/pdfwriter:\
12 :af=/var/spool/lpd/pdfwriter/pdfwriter.acct:\
13 :sh:\
14 :lp=/dev/null:\
15 :lpd_bounce=true:\
16 :if=/usr/share/printconf/pdffilter:
8 CraigBox 17 </verbatim>
1 GreigMcGill 18
19 Next, I created the pdffilter script as follows:
20
8 CraigBox 21 <verbatim>
22 #!/bin/bash
1 GreigMcGill 23
8 CraigBox 24 DOMAIN="yourdomain.co.nz"
25 PDF=`which ps2pdf`
26 MUA=`which mutt`
27 BODY="/usr/share/printconf/body"
28 TEMPFILE1="/tmp/output.ps-$RANDOM"
29 TEMPFILE2="/tmp/output$RANDOM.pdf"
30 TEMPFILE3="/tmp/cmd$RANDOM.txt"
31 SUBJECT="PDF Output."
32 ADDRESS="`echo $1 | sed -e 's/-A//' | awk -F@ '{ print $1 }'`@$DOMAIN"
33 CMDLINE="`echo $*`"
1 GreigMcGill 34
8 CraigBox 35 echo $CMDLINE > $TEMPFILE3
36 cat > $TEMPFILE1
37 $PDF -dPDFSETTINGS=/prepress -sPAPERSIZE=a4 $TEMPFILE1 $TEMPFILE2
1 GreigMcGill 38
8 CraigBox 39 $MUA -a $TEMPFILE2 -s "$SUBJECT" $ADDRESS < $BODY
1 GreigMcGill 40
8 CraigBox 41 rm -f $TEMPFILE1
42 rm -f $TEMPFILE2
43 rm -f $TEMPFILE3
44 </verbatim>
1 GreigMcGill 45
46 /usr/share/printconf/body is just the message you want to email your users.
47 Feel free to experiment with PDFSETTINGS, I have found the /prepress one seems to give the best quality output.
7 GreigMcGill 48
49 Note: For Samba setups using winbind, you will end up with emails going to DOMAIN/user@yourdomain.co.nz. A fix for this (awk/optimisation geeks, condense at will!) is:
50
8 CraigBox 51 <verbatim>
7 GreigMcGill 52 ADDRESS="`echo $1 | sed -e 's/-A//' | awk -F@ '{ print $1 }' | awk -F/ '{ print $2 }'`@$DOMAIN"
8 CraigBox 53 </verbatim>
1 GreigMcGill 54
8 CraigBox 55 For your windows clients, just add a postscript printer (any will do - I use Kodak Color~Ease PS - no reason, just out of habit), and point it at \\servername\pdfwriter.
1 GreigMcGill 56
57 The job will be emailed to the same name the print job was submitted under, so ensure there are aliases for these if they differ from your email address namespace. This also assumes you have mutt, an mta, and ps2pdf installed.
58
59 Hope this is useful.
5 MarcelNoe 60
61 NOTE: This solution also works under other distributions as long as you use LPRng not standard bsd lpr is installed. We are using debian (just enter "apt-get install lprng") - our printcap file looks like this:
62
8 CraigBox 63 <verbatim>
5 MarcelNoe 64 lp:\
65 :sd=/var/spool/lpd/pdfwriter:\
66 :lp=/dev/null:\
67 :if=/usr/share/printconf/pdffilter:
8 CraigBox 68 </verbatim>
5 MarcelNoe 69
70
4 JohnMcPherson 71
72 ----
73 Part of CategoryPrinting
The following authors of this page have not agreed to the WlugWikiLicense. As such copyright to all content on this page is retained by the original authors.
  • MarcelNoe
The following authors of this page have agreed to the WlugWikiLicense.

PHP Warning

lib/plugin/WlugLicense.php (In template 'html'):99: Warning: Invalid argument supplied for foreach()

lib/plugin/WlugLicense.php (In template 'html'):111: Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument

lib/plugin/WlugLicense.php (In template 'html'):111: Notice: Undefined variable: ignore_authors