diff --git a/pstoricohddst-gdi b/pstoricohddst-gdi index e7f0f16..7a19e00 100755 --- a/pstoricohddst-gdi +++ b/pstoricohddst-gdi @@ -1,10 +1,26 @@ #!/bin/bash +function trapINT() { + [ "x$trp" = "x" ] && trp="yes" || return +# pid=`ps a | grep $uid | grep -v grep | awk ' { print $1 } '` +# [ ! "x$pid" = "x" ] && { kill $pid; sleep 5; } + sleep 3 + rm -rf $uid + exit +} + +function stop() { + echo "stop" > $uid/999999999-page.pbm +} + +trap "stop; trapINT" SIGINT SIGTERM SIGQUIT +#trap 'echo No' SIGINT SIGTERM SIGQUIT EXIT; # Username user="$2" # Page title (not used at this time, "Document" instead) ptitle="$3" +my="$0" # Printing date ddate="`LC_ALL=en_US.UTF-8 date '+%Y/%m/%d %H:%M:%S'`" @@ -13,11 +29,12 @@ ddate="`LC_ALL=en_US.UTF-8 date '+%Y/%m/%d %H:%M:%S'`" uid="/tmp/pstoricohddst-gdi-`uuidgen`" mkdir -p $uid -# Converting from PostScript to PostScript-monochrome, then to PBM image format (per page) -gs -sDEVICE=psmono -sOutputFile=- -r600 -dQUIET -dBATCH -dNOPAUSE - | gs -sDEVICE=pbmraw -sOutputFile=${uid}/%d-page.pbm -r600 -dQUIET -dBATCH -dNOPAUSE - - -# Flushing PJL header -cat < $uid/raster.jbig - # Converting page to JBIG format (parameters are very special for this printer!) - pbmtojbg -p 72 -o 3 -m 0 -q < $uid/$page > $uid/raster.jbig + # Taking image size + jsize=`wc -c < $uid/raster.jbig` - # Taking image size - jsize=`wc -c < $uid/raster.jbig` + # Taking image dimensions + read fn ft xs ys garb < <(identify $uid/raster.jbig | tr "x" " ") - # Taking image dimensions - read fn ft xs ys garb < <(identify $uid/raster.jbig | tr "x" " ") - - # Flushing page header - cat <