#! /usr/bin/perl # # ps-shift.pl -- pnmtops などが出力した PostScript イメージの # 出力位置を変更する # $xoff=0; $yoff=0; while ($#ARGV >= 0) { $x = shift; if ($x eq "-x") { $xoff = 0 + shift; } elsif ($x eq "-y") { $yoff = 0 + shift; } elsif ($x eq "-xmm") { $xoff = 0 + shift; } elsif ($x eq "-ymm") { $yoff = 0 + shift; } elsif ($x eq "-xin") { $xoff = 0 + 25.4 * shift; } elsif ($x eq "-yin") { $yoff = 0 + 25.4 * shift; } elsif ($x eq "-xpt") { $xoff = 0 + 25.4 / 72 * shift; } elsif ($x eq "-ypt") { $yoff = 0 + 25.4 / 72 * shift; } else { print STDERR "Usage: ps-shift.pl [- #]\n"; exit 0; } } while () { print; if (/([0-9.]+)\s+([0-9.]+)\s+translate/) { last; } } print "% % % ($xoff, $yoff)\n"; print "$xoff 25.4 div 72 mul $yoff 25.4 div 72 mul translate\n"; while () { print; } exit 0;