[lug] Virtual Printer that makes booklets

Bruce Long qstream at gmail.com
Thu Aug 11 14:38:11 MDT 2011


Hi everyone,
I just spent some time getting a printer backend to CUPS that prints
booklets to work. I think I'll share it here in case anyone else is
interested.

1.  Get the following ppd and save it somewhere (right click/save as). I
saved it in my home directory so it would still be there if I upgrade Linux.


http://www.openprinting.org/ppd-o-matic.php?driver=Postscript&printer=Generic-PostScript_Printer&show=1

2. Install postscript utilities:

    sudo apt-get install psutils

3.  Take the following (which I modified from something I found on the web)
and (as root) save it as

    /usr/lib/cups/backend/bookletpipe

==========================================
#!/bin/bash
# (I'm at home in "/usr/lib/cups/backend/mypipe")

# check number of arguments (embodied in $#):
case $# in
0) echo "file bookletpipe \"Unknown\" \"Print a booklet\""
exit 0
;;
5) INPUT="-"
break
;;
6) INPUT="$6"
break
;;
*) echo "Wrong number of arguments"
echo "Usage: bookletpipe job-id user title copies options [file]"
exit 1
;;
esac

# do the backend's job:

cat $INPUT | psbook -q | lpr -P HP-Color-LaserJet-CM2320-MFP -o number-up=2

exit 0
============================================

4.  Set its permissions and restart cups

     sudo chmod a+x /usr/lib/cups/backend/bookletpipe
     sudo killall -HUP cupsd


4.5.  You can test that the new device is found my running "lpinfo -v".  You
should see a line "file bookletpipe"


5.  Edit the file and replace the name of my printer with the physical
printer you want to use. This is in the line that begins 'cat'.

6. Create a new printer:

    lpadmin -p BookletPrinter -v bookletpipe:/tmp -E -P
~/Generic-PostScript_Printer-Postscript.ppd

    NOTE: BookletPrinter can be anything you want your printer to be called.

    NOTE: The -P argument should be the ppd file you saved in step 1.

6. You should have a new printer that you can print to. Anything printed to
it will be made into a booklet.
    My printer has full duplex. I don't know what will happen if you try it
with a printer that does not.


7. Enjoy saving paper and using reading glasses!


Bruce
-- 
Give me immortality or give me death!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20110811/2bf0680c/attachment.html>


More information about the LUG mailing list