Differences between current version and revision by previous author of SambaPDFPrinter.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 8 | Last edited on Tuesday, December 2, 2003 3:24:55 pm | by CraigBox | |
Older page: | version 7 | Last edited on Tuesday, December 2, 2003 2:17:44 pm | by GreigMcGill | Revert |
@@ -1,10 +1,11 @@
!!A Samba Printer that will Email you a PDF.
-OK, just initial notes. These will be
RedHat specific
(as that's what we use - sorry guys!), and use
LPRng. See [CUPSNotes] for a [CUPS] version of this system.
+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.
First, I defined a queue in printcap like so:
+<verbatim>
pdfwriter:\
:ml#0:\
:mx#0:\
:sd=/var/spool/lpd/pdfwriter:\
@@ -12,54 +13,61 @@
:sh:\
:lp=/dev/null:\
:lpd_bounce=true:\
:if=/usr/share/printconf/pdffilter:
+</verbatim>
Next, I created the pdffilter script as follows:
-\
#!/bin/bash%%%
+<verbatim>
+
#!/bin/bash
-DOMAIN="yourdomain.co.nz"%%%
-PDF=`which ps2pdf`%%%
-MUA=`which mutt`%%%
-BODY="/usr/share/printconf/body"%%%
-TEMPFILE1="/tmp/output.ps-$RANDOM"%%%
-TEMPFILE2="/tmp/output$RANDOM.pdf"%%%
-TEMPFILE3="/tmp/cmd$RANDOM.txt"%%%
-SUBJECT="PDF Output."%%%
-ADDRESS="`echo $1 | sed -e 's/-A//' | awk -F@ '{ print $1 }'`@$DOMAIN"%%%
-CMDLINE="`echo $*`"%%%
+DOMAIN="yourdomain.co.nz"
+PDF=`which ps2pdf`
+MUA=`which mutt`
+BODY="/usr/share/printconf/body"
+TEMPFILE1="/tmp/output.ps-$RANDOM"
+TEMPFILE2="/tmp/output$RANDOM.pdf"
+TEMPFILE3="/tmp/cmd$RANDOM.txt"
+SUBJECT="PDF Output."
+ADDRESS="`echo $1 | sed -e 's/-A//' | awk -F@ '{ print $1 }'`@$DOMAIN"
+CMDLINE="`echo $*`"
-echo $CMDLINE > $TEMPFILE3%%%
-cat > $TEMPFILE1%%%
-$PDF -dPDFSETTINGS=/prepress -sPAPERSIZE=a4 $TEMPFILE1 $TEMPFILE2%%%
+echo $CMDLINE > $TEMPFILE3
+cat > $TEMPFILE1
+$PDF -dPDFSETTINGS=/prepress -sPAPERSIZE=a4 $TEMPFILE1 $TEMPFILE2
-$MUA -a $TEMPFILE2 -s "$SUBJECT" $ADDRESS < $BODY%%%
+$MUA -a $TEMPFILE2 -s "$SUBJECT" $ADDRESS < $BODY
-rm -f $TEMPFILE1%%%
-rm -f $TEMPFILE2%%%
-rm -f $TEMPFILE3%%%
+rm -f $TEMPFILE1
+rm -f $TEMPFILE2
+rm -f $TEMPFILE3
+</verbatim>
/usr/share/printconf/body is just the message you want to email your users.
Feel free to experiment with PDFSETTINGS, I have found the /prepress one seems to give the best quality output.
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:
+<verbatim>
ADDRESS="`echo $1 | sed -e 's/-A//' | awk -F@ '{ print $1 }' | awk -F/ '{ print $2 }'`@$DOMAIN"
+</verbatim>
-For your windows clients, just add a postscript printer (any will do - I use Kodak !ColorEase
PS - no reason, just out of habit), and point it at \\servername\pdfwriter.
+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.
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.
Hope this is useful.
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:
+<verbatim>
lp:\
:sd=/var/spool/lpd/pdfwriter:\
:lp=/dev/null:\
:if=/usr/share/printconf/pdffilter:
+</verbatim>
----
Part of CategoryPrinting