Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/lib/lp/process/pdfgs – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#!/bin/rc
2
# pdfgs pdffile [gsdev] - generate PS from PDF
3
#
4
# we don't go through postscript, because to
5
# get to postscript, we send the pdf through gs!
6
# much easier to just go directly.
7
 
8
switch($#*) {
9
case 2
10
	GSDEVICE=$2
11
case 1
12
	GSDEVICE=`{echo $LPCLASS | sed 's/(.*\+)?gs!([^+]*)(\+.*)?/\2/'}
13
case *
14
	echo 'usage: pdfgs pdffile [gsdev]' >[1=2]
15
	exit usage
16
}
17
 
18
GSTMPFILE=/tmp/pdf^$pid
19
GSOPT=('-sDEVICE='$GSDEVICE '-sOutputFile='^$GSTMPFILE -dSAFER -dNOPAUSE \
20
	-dQUIET -dBATCH -dNOPAUSE)
21
 
22
# ps level 1 is extremely verbose and tends to run our
23
# printers out of memory when printing images.
24
if(~ $GSDEVICE pswrite && ~ $LPCLASS *post2*)
25
	GSOPT=($GSOPT '-dLanguageLevel=2')
26
if not if(~ $GSDEVICE pswrite)
27
	GSOPT=($GSOPT '-dLanguageLevel=1')
28
 
29
if(~ $OLIST '')
30
	gs $GSOPT $1
31
if not {
32
	PGLIST=`{echo $OLIST | sed 's/-o//;s/,/ /g;s/	/ /g' | tr -cd '0-9 -'}
33
	GSPGLIST=()
34
	for(i in $PGLIST){
35
		switch($i){
36
		case -*
37
			GSPGLIST=($GSPGLIST `{seq 1 `{echo $i|tr -d '-'}})
38
		case *-
39
			# BUG assume 100 >= number of pages
40
			GSPGLIST=($GSPGLIST `{seq `{echo $i|tr -d '-'} 100})
41
		case *-*
42
			GSPGLIST=($GSPGLIST `{seq `{echo $i|tr '-' ' '}})
43
		case *
44
			GSPGLIST=($GSPGLIST $i)
45
		}
46
	}
47
	GSPGLIST=$"GSPGLIST
48
	echo '
49
		/Page null def
50
		/Page# 0 def
51
		/PDFSave null def
52
		/DSCPageCount 0 def
53
		/DoPDFPage {dup /Page# exch store pdfgetpage pdfshowpage} def
54
		GS_PDF_ProcSet begin
55
		pdfdict begin
56
		('^$1^') (r) file pdfopen begin
57
		/npage pdfpagecount def
58
		['^$GSPGLIST^']
59
		{
60
			dup dup
61
				1 ge exch npage le and 
62
				{ DoPDFPage }
63
				{ pop }
64
			ifelse
65
		} forall
66
	' | gs $GSOPT - >/dev/null >[2=1]
67
}
68
 
69
cat $GSTMPFILE
70
rm -f $GSTMPFILE
71
exit ''