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