#! /usr/bin/awk -f # # usage: fixgs6ps < gs6pswrite.ps > fixed.ps # # Modify PostScript generated by "pswrite" device # of Ghostscript 6.01 so that PSUtils work. # # written by Yasha, public domain BEGIN { # XXX assume A4 paper PAPERWIDTH = 595 PAPERHEIGHT = 842 } # convert # << /PageSize [w h] >> setpagedevice # to # (PAPERWIDTH-w)/2 (PAPERHEIGHT-h)/2 translate /^<< \/PageSize/ { width = substr($3, 2) height = substr($4, 1, length($4) - 1) print (PAPERWIDTH - width) / 2, (PAPERHEIGHT - height) / 2, "translate" next } { print }