[the cellar]
Electronics
I2C
Linux
LiLA Howto
WWW Dial-In
Bookprint
About us
Breiti
Füri
Hofi
Holger
Jüpi
Reisi
Sepp
LAN Sessions
Photo Gallery
Statistics
Guestbook
Sign Guestbook
Read Guestbook
Close menu
 

book-print

  Introduction

    book-print is small shell-script which allows you to print Postscript-files like a book (the second page is printed on the backside of the first :)
    First of all, book-print prints all odd pages (starting with the highest one) and then it waits for you. Now you have to wait until all pages are printed (just wait for page number 1...). After this, you just have to turn around the staple of printed paper and book-print does the rest for you. It prints all even pages on the backside of the pages.
    book-print is also quite good to use with endless-paper. Just print the odd pages, cut off the paper, turn it around, and print the even pages.

    NOTE: book-print is just a quick and dirty script with no comfort. I wrote it, because I needed it someday - that´s it. If you don´t have an old epson printer, you have to adapt the script to fit your needs (It also don´t works on my computer anymore, since I have a new printer now ;)

  System requirements

  • Ghostscript
  • lpr
  • printer and paper :-)

  The script

    #!/bin/sh
    
    # small script to print postscript-files "book-like"
    # syntax: ./book-print filetoprint.ps
    declare -i NUMBER_OF_PAGES=1 # needs to be 1
    declare -i NOW_PRINTING=0
    echo Printing $1
    echo 'Creating temporary page-images...'
    gs -q -dSAFER -dNOPAUSE -sDEVICE=epson -sPapersize=letter -r180x180
    -sOutputFile=output%d.epson $1 -c quit
    while ( test -e output$NUMBER_OF_PAGES.epson);
    do NUMBER_OF_PAGES=NUMBER_OF_PAGES+1;
    done
    NUMBER_OF_PAGES=NUMBER_OF_PAGES-1
    echo Found $NUMBER_OF_PAGES pages.
    echo 'Sending odd pages to lpr...'
    if ( expr $NUMBER_OF_PAGES % 2); then {
    NOW_PRINTING=NUBER_OF_PAGES;
    };
    else
    {
    NOW_PRINTING=NUMBER_OF_PAGES-1;
    }
    fi
    while ( test $NOW_PRINTING -gt 0 );
    do {
    lpr -Praw output$NOT_PRINTING.epson
    NOW_PRINTING=NOW_PRINTING-2
    };
    done
    echo ''
    echo 'Please wait until all pages have been printed...'
    echo 'Then turn the printed pages around and give them'
    echo 'back to your printer...' # Nice sentence, isnīt it ?
    echo 'Then press RETURN'
    read dummy
    echo 'Sending even pages to lpr...'
    if ( expr $NUMBER_OF_PAGES % 2 ); then {
    NOW_PRINTING=NUMBER_OF_PAGES-1;
    };
    else
    {
    NOW_PRINTING=NUMBER_OF_PAGES;
    };
    fi
    while ( test $NOW_PRINTING -gt 0 );
    do {
    lpr -Praw output$NOW_PRINTING.epson
    NOW_PRINTING=NOW_PRINTING-2
    };

    done
    echo 'All sent.'
    echo 'Removing all temporary files...'
    rm output*.epson

hosted by Geocities

Breitenberger Markus breitenberger@gmx.net
Last update: Sat May 22 11:44:38 1999
http://geocities.datacellar.net/SiliconValley/2017/linux/bookprint.html
WebCounter by GOWEB

1