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/* Convert PostScript to PDF 1.4 (Acrobat 5-and-later compatible). */
7/* The PDF compatibility level may change in the future: */
8/* use ps2pdf12 or ps2pdf13 if you want a specific level. */
9
10parse arg params
11
12gs='@gsos2'
13inext='.ps'
14outext='.pdf'
15
16if params='' then call usage
17
18options=''
19
20/* extract options from command line */
21i=1
22param=word(params,i)
23do while substr(param,1,1)='-'
24	options=options param
25	i=i+1
26	param=word(params,i)
27end
28
29infile=param
30if infile='' then call usage
31outfile=word(params,i+1)
32if outfile='' then do
33	outfile=infile''outext
34	infile=infile''inext
35end
36
37gs options '-q -P- -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile='outfile options '-c save pop -f' infile
38exit
39
40usage:
41say 'Usage: ps2pdf [options...] input[.ps output.pdf]'
42exit
43