#!/bin/sh

#
# Syntax: fax2pdf fax1.g3 fax2.g3 ...
#

STRETCH=""      # default no stretch
P=0             # reset count
TMP=/tmp/fax$$          # set temp name

> $TMP.ps
for FILE in $*; do
   P=`expr $P + 1`
   RES=`basename $FILE | sed 's/.\(.\).*/\1/'`
   [ "$RES" = "n" ] && STRETCH="-s"
   g32pbm $STRETCH $FILE 2>/dev/null | pnmtops >>$TMP.ps
done
ps2pdf -sPAPERSIZE=a4 $TMP.ps $TMP.pdf
FILENAME=`echo $FILE | cut -f1 -d.`
echo "PDF wurde erstellt:"
echo $TMP.pdf
