xref: /plan9/sys/src/cmd/gs/lib/ps2epsi.bat (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1@echo off
2@rem $Id: ps2epsi.bat,v 1.9 2002/04/25 21:29:08 ghostgum Exp $
3
4if %1/==/ goto usage
5if %2/==/ goto usage
6
7call gssetgs.bat
8set infile=%1
9set outfile=%2
10
11rem Ghostscript uses %outfile% to define the output file
12%GSC% -q -dNOPAUSE -dSAFER -dDELAYSAFER -sDEVICE=bit -sOutputFile=NUL ps2epsi.ps < %infile%
13
14rem We bracket the actual file with a few commands to help encapsulation
15echo %%%%Page: 1 1 >> %outfile%
16echo %%%%BeginDocument: %outfile% >> %outfile%
17echo /InitDictCount countdictstack def gsave save mark newpath >> %outfile%
18
19rem Append the original onto the preview header
20copy %outfile% + %infile%
21
22echo %%%%EndDocument >> %outfile%
23echo countdictstack InitDictCount sub { end } repeat >> %outfile%
24echo cleartomark restore grestore >> %outfile%
25
26goto end
27
28:usage
29echo "Usage: ps2epsi <infile.ps> <outfile.epi>"
30
31:end
32