Subversion Repositories planix.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#!/bin/rc
2
# pdf2ps [-e] [gs-options] [input.pdf [output.ps]] - generate (e)ps from pdf
3
rfork e
4
 
5
fn usage {
6
	echo 'usage: pdf2ps [-e] [gs-options] [input.pdf [output.ps]]' >[1=2]
7
	exit usage
8
}
9
 
10
outdev=pswrite
11
fin=/fd/0
12
fout=/fd/1
13
lang=(-'dLanguageLevel=2')
14
opt=()
15
while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 - --){
16
	if(~ $1 '-dLanguageLevel='*)
17
		lang=()
18
	if not if(~ '-?' $1)
19
		usage
20
	if(~ $1 -e)
21
		outdev=epswrite
22
	if not
23
		opt=($opt $1)
24
	shift
25
}
26
if(~ $1 --)
27
	shift
28
 
29
switch($#*){
30
case 0
31
	;
32
case 1
33
	fin=$1
34
case 2
35
	fin=$1
36
	fout=$2
37
case *
38
	usage
39
}
40
 
41
if(~ $fin -)
42
	fin=/fd/0
43
if(~ $fout -)
44
	fout=/fd/1
45
 
46
# Doing an inital `save' helps keep fonts from being flushed between
47
# pages.  We have to include the options twice because -I only takes
48
# effect if it appears before other options.
49
 
50
exec gs $opt -dSAFER -dNOPAUSE -dBATCH -q -s'DEVICE='$outdev $opt $lang \
51
	-s'OutputFile=-' -c save pop -f $fin >$fout