#!/bin/bash # Username user="$2" # Page title (not used at this time, "Document" instead) ptitle="$3" # Printing date ddate="`LC_ALL=en_US.UTF-8 date '+%Y/%m/%d %H:%M:%S'`" # Temporary directory 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 # Taking image size jsize=`wc -c < $uid/raster.jbig` # Taking image dimensions read fn ft xs ys garb < <(identify $uid/raster.jbig | tr "x" " ") # Flushing page header cat <