xref: /plan9/sys/src/cmd/gs/lib/ps2ascii (revision 80ee5cbfe36716af62da8896207e9763b8e3d760)
1#!/bin/sh
2# $Id: ps2ascii,v 1.2 2000/05/19 06:38:25 lpd Exp $
3# Extract ASCII text from a PostScript file.  Usage:
4#	ps2ascii [infile.ps [outfile.txt]]
5# If outfile is omitted, output goes to stdout.
6# If both infile and outfile are omitted, ps2ascii acts as a filter,
7# reading from stdin and writing on stdout.
8
9trap "rm -f _temp_.err _temp_.out" 0 1 2 15
10
11OPTIONS="-q -dNODISPLAY -dSAFER -dNOBIND -dWRITESYSTEMDICT -dSIMPLE"
12if ( test $# -eq 0 ) then
13	gs $OPTIONS -c save -f ps2ascii.ps - -c quit
14elif ( test $# -eq 1 ) then
15	gs $OPTIONS -c save -f ps2ascii.ps $1 -c quit
16else
17	gs $OPTIONS -c save -f ps2ascii.ps $1 -c quit >$2
18fi
19