#! /usr/bin/gawk -f # Last edited on 2003-10-12 15:22:32 by stolfi BEGIN { # Adapted from P. J. Rezende # Tries to change a Postscript file from A4 formatting to Letter. # This requires slight translation and rescaling as well # as changes in the paper selection %%-commands. # Be sure to run "diff" and check the changes... ignore = 0; } /^%%BeginProlog:/ { print $0; print "%%PaperSize: Letter % fix-a4-size"; print "%%"; ignore = 0; next; } /^%%Page:/ { print $0; print "0.98 0.98 scale % fix-a4-size"; print "0 -40 translate % fix-a4-size"; print "%%"; ignore = 0; next; } /^%%PaperSize:/ { print ("% was: " $0 " % fix-a4-size" ); next; } /^%%BeginPaperSize:/ { print ("% was: " $0 " % fix-a4-size" ); ignore = 1; next; } /^%%EndPaperSize/ { print ("% was: " $0 " % fix-a4-size" ); ignore = 0; next; } (ignore) { print ("% was: " $0 " % fix-a4-size" ); next; } // { print; }