2 # pdfgs pdffile [gsdev] - generate PS from PDF
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.
12 GSDEVICE=`{echo $LPCLASS | sed 's/(.*\+)?gs!([^+]*)(\+.*)?/\2/'}
14 echo 'usage: pdfgs pdffile [gsdev]' >[1=2]
18 GSTMPFILE=/tmp/pdf^$pid
19 GSOPT=('-sDEVICE='$GSDEVICE '-sOutputFile='^$GSTMPFILE -dSAFER -dNOPAUSE \
20 -dQUIET -dBATCH -dNOPAUSE)
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')
32 PGLIST=`{echo $OLIST | sed 's/-o//;s/,/ /g;s/ / /g' | tr -cd '0-9 -'}
37 GSPGLIST=($GSPGLIST `{seq 1 `{echo $i|tr -d '-'}})
39 # BUG assume 100 >= number of pages
40 GSPGLIST=($GSPGLIST `{seq `{echo $i|tr -d '-'} 100})
42 GSPGLIST=($GSPGLIST `{seq `{echo $i|tr '-' ' '}})
44 GSPGLIST=($GSPGLIST $i)
53 /DoPDFPage {dup /Page# exch store pdfgetpage pdfshowpage} def
56 ('^$1^') (r) file pdfopen begin
57 /npage pdfpagecount def
61 1 ge exch npage le and
66 ' | gs $GSOPT - >/dev/null >[2=1]