#!/usr/bin/perl -sw ## ## makeabook -- converts a postscript file to a book format with two pages ## of text on each side of an A4 sheet. the sheets fold and bind ## into a book of same form-factor as most trade paperbacks. ## ## syntax: makeabook -book=file.ps ## ## Copyright (c) 1999, Vipul Ved Prakash. All rights reserved. ## This code is free software; you can redistribute it and/or modify ## it under the same terms as Perl itself. ## ## $Id$ die unless $book; my $filename = $book; $book =~ s/\.ps$//i; print "realigning pages...\n"; system "psbook -s4 $filename > $book-tempA.ps"; print "\nmerging pages...\n"; system "psnup -2 $book-tempA.ps > $book-tempB.ps"; system "rm $book-tempA.ps"; print "\nwriting front sides...\n"; system "psselect -o $book-tempB.ps > $book-FRONT.ps"; print "\nwriting back sides...\n"; system "psselect -e $book-tempB.ps > $book-BACK.ps"; system "rm $book-tempB.ps";