Penguin
Note: You are viewing an old revision of this page. View the current version.

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.

First, I defined a queue in printcap like so:

pdfwriter:\

:ml#0:\ :mx#0:\ :sd=/var/spool/lpd/pdfwriter:\ :af=/var/spool/lpd/pdfwriter/pdfwriter.acct:\ :sh:\ :lp=/dev/null:\ :lpd_bounce=true:\ :if=/usr/share/printconf/pdffilter:

Next, I created the pdffilter script as follows:

\#!/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 $*`"

echo $CMDLINE > $TEMPFILE3
cat > $TEMPFILE1
$PDF -dPDFSETTINGS=/prepress -sPAPERSIZE=a4 $TEMPFILE1 $TEMPFILE2

$MUA -a $TEMPFILE2 -s "$SUBJECT" $ADDRESS < $BODY

rm -f $TEMPFILE1
rm -f $TEMPFILE2
rm -f $TEMPFILE3

/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.

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.

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:

lp:\

:sd=/var/spool/lpd/pdfwriter:\ :lp=/dev/null:\ :if=/usr/share/printconf/pdffilter:


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:99: Warning: Invalid argument supplied for foreach()

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

lib/plugin/WlugLicense.php:111: Notice: Undefined variable: ignore_authors