Subversion Repositories planix.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#!/bin/rc
2
# ps2pdf - convert PostScript to PDF
3
rfork e
4
 
5
fn usage {
6
	echo 'usage: ps2pdf [gs-options] [input.ps [output.pdf]]' >[1=2]
7
	exit usage
8
}
9
 
10
# gs's pdfwrite sometimes emits bad pdf at level 1.2,
11
# but 1.4 seems to work fine.
12
compat=(-'dCompatibilityLevel=1.2')
13
opt=()
14
while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 - --){
15
	if(~ $1 '-dCompatibilityLevel='*)
16
		compat=()
17
	opt=($opt $1)
18
	shift
19
}
20
if(~ $1 --)
21
	shift
22
 
23
switch($#*){
24
case 0
25
	fin='-'
26
	fout='-'
27
case 1
28
	fin=$1
29
	fout='-'
30
case 2
31
	fin=$1
32
	fout=$2
33
case *
34
	usage
35
}
36
 
37
# We have to include the options twice because -I only takes effect
38
# if it appears before other options.
39
 
40
gscmd=( gs $opt -dSAFER -dNOPAUSE -dBATCH -q -s'DEVICE=pdfwrite' \
41
	$opt $compat \
42
	-s'OutputFile='$fout -c .setpdfwrite -f $fin)
43
exec $gscmd