xref: /plan9/sys/src/cmd/gs/lib/pdf2ps.cmd (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1/* $Id: pdf2ps.cmd,v 1.4 2002/02/21 21:49:28 giles 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/* Convert PDF to PostScript. */
8
9parse arg params
10
11gs='@gsos2'
12inext='.pdf'
13outext='.ps'
14
15if params='' then call usage
16
17options='-dNOPAUSE -dBATCH -dSAFER -sDEVICE=pswrite'
18
19/* extract options from command line */
20i=1
21param=word(params,i)
22do while substr(param,1,1)='-'
23	options=options param
24	i=i+1
25	param=word(params,i)
26end
27
28infile=param
29if infile='' then call usage
30outfile=word(params,i+1)
31if outfile='' then do
32	outfile=infile''outext
33	infile=infile''inext
34end
35
36gs '-q -sOutputFile='outfile options infile
37exit
38
39usage:
40say 'Usage: pdf2ps [-dASCII85DecodePages=false] [-dLanguageLevel=n] input[.pdf output.ps]'
41exit
42