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