[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] "creep" and booklets
From: |
Bob Diertens |
Subject: |
Re: [Groff] "creep" and booklets |
Date: |
Fri, 4 Nov 2005 10:21:59 +0100 |
User-agent: |
Mutt/1.5.5i |
On Fri, Nov 04, 2005 at 12:01:12AM -0000, Ted Harding wrote:
> Hi Folks,
>
> I'd welcome views and contributions about the following.
>
> It concerns making a "booklet" out of a PS document.
>
> 1. Background:
> If you have (say) a 16-page PS document, you can run it
> through the following pipelikne:
>
> cat doc.ps | psbook | psnup -2 > doclet.ps
>
> [ ... ]
You can easily do this by manipulating the PostScript file.
The Perl script below suffices.
usage:
cat doc.ps | psbook | creep 0.5 | psnup -2 > doclet.ps
Hope this helps,
Bob
---begin creep---
#!/usr/bin/perl
#
# Enjoy: Bob Diertens, 11/04/2005
if ($#ARGV != 0) {
die "usage: $0 <creep>\n";
}
$creep_incr = shift;
$pagecount = 0;
$creep = 0;
while (<>) {
print;
if (/^%%Page:/) {
if ($pagecount % 2) {
print "-$creep 0 translate\n";
} else {
print "$creep 0 translate\n";
}
$pagecount ++;
if ($pagecount %4 == 0) {
$creep += $creep_incr;
}
}
}
---end creep---