#
# faxspool.rules: configuration file for "faxspool"
#
# file suffixes and file format conversions that are not handled by 
# the built-in routines in "faxspool" can be added here
#
# $Id: faxspool.rules,v 4.4 2006/09/29 11:05:30 gert Exp $

# file name suffix -> file format mapping
# after the SUFFIX key word, name the extention, and then the file format:
#
# the following mappings are already built-in into faxspool:
#
#SUFFIX .g3 g3
#SUFFIX .asc ascii
#SUFFIX .txt ascii
#SUFFIX .ps ps
#SUFFIX .lj lj
#SUFFIX .pcl lj
#
# some useful mappings
SUFFIX .doc doc
SUFFIX .jpg jpg
SUFFIX .jpeg jpg

# file format -> conversion command rules
#
# $1 is set to the input file name, $2 is the base name for the 
# output file(s), and $3 is "-n", if normal resolution has been requested
#
# Warning: better use absolute path names here, as "faxspool" might be
#          called without a reasonable value for $PATH
#
#
# Again, some examples that are similar to what is already built in:
#
# postscript files (using dfaxhigh driver)
#FILTER ps /usr/bin/gs -sDEVICE=dfaxhigh -sOutputFile=$2%03d -dNOPAUSE -q -dSAFER - <$1
# postscript files (using faxg3 driver)
#FILTER ps /usr/bin/gs -sDEVICE=faxg3 -r204x196 -sOutputFile=$2%03d -dNOPAUSE -q -dSAFER - <$1
#
# ASCII files, filter via ghostscript
#FILTER ascii /usr/bin/gs -sDEVICE=dfaxhigh -sOutputFile=$2%03d -dNOPAUSE -q -- gslp.ps -fCourier-Bold10 -B $1
#
# G3 files are just filtered through "g3cat" to clean errors
#FILTER g3 /usr/local/bin/g3cat $1 >$2.001
#
# HP Laserjet stuff is filtered via "hp2hig3"...
#FILTER lj /usr/local/bin/hp2hig3 -r$2 <$1
#
#
# some mappings that can be used to override built-in rules, depending on
# what programs are installed in the system
#
# Adobe Postscript 
#  - Variant 1, via GNU Ghostscript (from pdf2ps)
#FILTER pdf /usr/bin/gs -sDEVICE=faxg3 -r204x196 -sOutputFile=$2%03d -dNOPAUSE -q -dSAFER -dBATCH -c save pop -f "$1"
#
#  - Variant 2, via Acrobat Reader
#FILTER pdf acroread -toPostScript <$1 | /usr/bin/gs -sDEVICE=faxg3 -r204x196 -sOutputFile=$2%03d -dNOPAUSE -q -dSAFER -dBATCH -
#
#  - Variant 3, via xpdf (pdftops is part of that package)
#FILTER pdf pdftops $1 - | /usr/bin/gs -sDEVICE=faxg3 -r204x196 -sOutputFile=$2%03d -dNOPAUSE -q -dSAFER -dBATCH -
#
#
# some mappings for stuff that is not built-in
#
# Winword via antiword
FILTER doc /usr/bin/antiword -p a4 $1 | /usr/bin/gs -sDEVICE=faxg3 -r204x196 -sOutputFile=$2%03d -dNOPAUSE -q -dSAFER -dBATCH -
FILTER doc-n /usr/bin/antiword -p a4 $1 | /usr/bin/gs -sDEVICE=faxg3 -r204x98 -sOutputFile=$2%03d -dNOPAUSE -q -dSAFER -dBATCH -
#
# JPG (assumes pretty recent netpbm package)
FILTER jpg djpeg -grey $1 | pnmscale -xysize 1728 2000 | pamditherbw | pamtopnm | pbm2g3 >$2.001
FILTER jpg-n djpeg -grey $1 | pnmscale -xysize 1728 1000 | pamditherbw | pamtopnm | pbm2g3 >$2.001
