Printing PDF files to network printers

Ralf Schade catalysm at gmx.de
Sat Oct 30 01:06:56 PDT 2010


"Elly K" <andrewdsj at hotmail.com> schrieb im Newsbeitrag 
news:38281-cups.general at news.easysw.com...
> Hi list, I have a bunch of PDF files being written to a common folder by 
> different applications.  The users needs each of these files to be printed 
> to specific printers on the network.
>
> I am sure CUPS can print each of these files to specific printers on the 
> network.  But how would CUPS know which PDF file needs to go to which 
> printer?  Is there a way to do that?  Any ideas, pointers would be greatly 
> appreciated... Thanks!

Hi Elly.
If you are able to name the pdf's to your needs, it's very simple ;-)
Create a script under /usr/lib/cups/filter, name it to whatever you want, 
let's say 'printertopdf'.

Set FileDevice yes in your cupsd.conf
Create a new print queue with DeviceURI file:/dev/null
lpadmin -p printqueuename -E -P /path/to/postscript.ppd.gz -v file:/dev/null

Do not start cups at this moment. If it runs, stop it ;)
Edit /etc/cups/printers.conf an in the newly created queue and insert 
between <Printer printqueuename> and </Printer>:
Filter application/pdf 0 printertopdf

In the script use (taken from dvitops):

#!/bin/sh

if test "$#" -lt "5"; then
        echo "ERROR: Number of arguments ($#) is wrong" 1>&2
        exit 1
fi

if test "$#" -gt "6"; then
        echo "ERROR: Number of arguments ($#) is wrong" 1>&2
        exit 1
fi

# Log the command line
echo dvitops: $@  1>&2

# Get the last parameter (which is the filename if present)
eval filename="\${$#}"

case "$filename" in
    printer1.pdf)
        lp -d printer1 $filename
    ;;
esac

You now got your file which must be printed ;)
Depending on your filenames you are now able to take the right printer to 
print the pdf ;)


 





More information about the cups mailing list