#!/bin/bash if [ ! -f "$1" ]; then echo "File not found: $1" exit fi DIRNAME=$(dirname $1) FILENAME=$(basename $1) # Remove the extension from the filename. BASENAME=${FILENAME%%.*} FILETYPE=${FILENAME##*.} LIGHTGRAY="#f3f3f3" cat ../../enscript-header.txt $1 > /tmp/$FILENAME enscript --escapes --color -f Courier10 -X ps -B -1 --highlight=$FILETYPE \ $2 -h -o - /tmp/$FILENAME | \ gs -dSAFER -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dNOPAUSE -r600 \ -sOutputFile=$BASENAME.png -dBackgroundColor=16$LIGHTGRAY #> /dev/null && \ #convert -trim $BASENAME.png $BASENAME-trimmed.png && \ #mv $BASENAME-trimmed.png $BASENAME.png # rm -f /tmp/$FILENAME