Steve,
After I wrote my response, I recalled having worked with
Andy Mai on this several years ago. Here is a perl script
that will do what you want.
Fred
#!/fs/local/bin/perl
#
# Take a PostScript file containing an arbitrary number of frames and
# reformat it to scale the plots and place them at specified locations
# on the page. The name of the input file and a description of the
# formatting for the pasted-up pages is in another file, so that this
# command should be invoked as, e.g., "psfm description". The output
# file name is the same as the input name with "_PSFM" appended to the
# root.
#
# Sample description file:
# gmeta.ps
# 2
# 5.0 4.25 7.75
# 5.0 4.25 4.0
#
# The first line is the input file name.
# The second line is the number of frames per page.
# Then follows one line for each frame:
# size, x-location, y-location all in inches from lower left hand
# corner of the page to the center of the NCAR Graphics frame
$headlines = 15; # number of lines in color PostScript header
$osiz = 7.07986111; # original size (inches) of output from ctrans ps.color
open(DESCR,"@ARGV");
$infile = <DESCR>;
$infile =~ /\.ps$/ || die "\n Input file name must be of the form \*.ps\n\n";
($outfile = $infile) =~ s/\.ps/_PSFM.ps/;
print "\n Reading from input file : ",$infile;
print " Output file : ",$outfile;
open(INPUT,"$infile");
open(OUTPUT,">$outfile");
foreach (1..$headlines) {
$line = <INPUT>;
print OUTPUT $line;
}
print OUTPUT "/a {translate} def\n";
print OUTPUT "/z {initmatrix} def\n";
$nfpp = <DESCR>;
print " Number of frames per page: ",$nfpp;
$knt = 1;
<INPUT>;
$sizxy = <DESCR>;
($siz, $x, $y) = split(/ /, $sizxy);
$sf = $siz / $osiz;
$xt = ($x - $siz/2.0) * 576 / $sf - 404;
$yt = ($y - $siz/2.0) * 576 / $sf - 1124;
$scale = .125 * $sf;
printf OUTPUT "%9.7f%10.7f%s%5.0f%6.0f%s", $scale,$scale," s\n", $xt,$yt," a\n";
while(<INPUT>) {
if (/^ h/) {
if ($knt == $nfpp) {
$knt = 1;
close(DESCR);
open(DESCR,"@ARGV");
<DESCR>;
<DESCR>;
print OUTPUT "h\n";
}
else {
++$knt;
}
<INPUT>;
<INPUT>;
$sizxy = <DESCR>;
($siz, $x, $y) = split(/ /, $sizxy);
$sf = $siz / $osiz;
$xt = ($x - $siz/2.0) * 576 / $sf - 404;
$yt = ($y - $siz/2.0) * 576 / $sf - 1124;
$scale = .125 * $sf;
printf OUTPUT "%s%9.7f%10.7f%s%5.0f%6.0f%s","z\nn\n",$scale,$scale," s\n",$xt,$yt," a\n";
}
elsif (/^ r/) {
if ($knt != 1) { print OUTPUT "h\n"; }
print OUTPUT "r\n";
}
else {
s/^ //; # remove leading blanks
print OUTPUT $_;
}
}
print " Normal termination of PSFM\n\n";
This archive was generated by hypermail 2b29 : Mon Nov 05 2001 - 08:18:43 MST