3 # usage: pdfgsijs pdffile
5 gs -dSAFER -dNOPAUSE -dBATCH -q -s'DEVICE=pswrite' -d'LanguageLevel=2' -s'OutputFile=/tmp/pdf2ps.ps' $1
7 MODEL=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)(\+.*)?/\2/'}
8 NUMBER=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)\+(.*)?/\3/'}
10 GSTMPFILE=/tmp/pdf^$pid
14 GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -dBATCH)
16 GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -dDuplex'='true -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -DBATCH)
21 gs $GSOPT /tmp/pdf2ps.ps
23 PGLIST=`{echo $OLIST | sed 's/-o//;s/,/ /g;s/ / /g' | tr -cd '0-9 -'}
28 GSPGLIST=($GSPGLIST `{seq 1 `{echo $i|tr -d '-'}})
30 # BUG assume 100 >= number of pages
31 GSPGLIST=($GSPGLIST `{seq `{echo $i|tr -d '-'} 100})
33 GSPGLIST=($GSPGLIST `{seq `{echo $i|tr '-' ' '}})
35 GSPGLIST=($GSPGLIST $i)
44 /DoPDFPage {dup /Page# exch store pdfgetpage pdfshowpage} def
47 ('^$1^') (r) file pdfopen begin
48 /npage pdfpagecount def
52 1 ge exch npage le and
57 ' | gs $GSOPT - >/dev/null >[2=1]