1/* 2 * This file is maintained by a user: if you have any questions about it, 3 * please contact Mark Hale (mark.hale@physics.org). 4 */ 5 6@echo off 7if %1/==/ goto usage 8if %2/==/ goto usage 9 10set infile=%1 11set outfile=%2 12 13rem First we need to determine the bounding box. ps2epsi.ps below will pick 14rem the result up from %outfile% 15gsos2 -q -dNOPAUSE -dBATCH -P- -sDEVICE=bbox -sOutputFile=NUL %infile% 2> %outfile% 16 17rem Ghostscript uses %outfile% to define the output file 18gsos2 -q -dNOPAUSE -P- -sDEVICE=bit -sOutputFile=NUL ps2epsi.ps < %infile% 19 20rem We bracket the actual file with a few commands to help encapsulation 21echo %%%%Page: 1 1 >> %outfile% 22echo %%%%BeginDocument: %outfile% >> %outfile% 23echo /InitDictCount countdictstack def gsave save mark newpath >> %outfile% 24echo userdict /setpagedevice /pop load put >> %outfile% 25 26rem Append the original onto the preview header 27copy %outfile% + %infile% 28 29echo %%%%EndDocument >> %outfile% 30echo countdictstack InitDictCount sub { end } repeat >> %outfile% 31echo cleartomark restore grestore >> %outfile% 32 33goto end 34 35:usage 36echo "Usage: ps2epsi <infile.ps> <outfile.epi>" 37 38:end 39