Hi,
On Thu, Mar 16, 2023 at 01:39:41PM +0100, Volker Englisch wrote:
> Is this group still alive?
Not really right now, the old list broke and I have not imported all
participants into a new to-be-setup list yet. But sometimes things
are happening, like today :-)
> I want mgetty to mail every received fax as a pdf to a local recipient. For
> that reason, I modified one of the samples of new_fax like this (only the
> more intersting part follows):
>
>
> (
> echo "Subject: fax from $SENDER, page $P of $PAGES"
> echo "To: $MAILTO"
> echo ""
> $G3TOPBM $STRETCH $FAX | pbmtolps > /tmp/$$.ps
> ps2pdf /tmp/$$.ps /tmp/$$.pdf
> uuencode /tmp/$$.pdf $$.pdf
> ) | $MAILER $MAILTO
>
> It works so far. But the quality of the resulting pdf's is poor. They also
> seem to be shrinked instead of filling an entire A4 page (like received).
The best way I've found is to use the libtiff tools, first fax2tiff to
convert from G3 to tiff, and then tiff2ps -> ps2pdf to pdf - this
produces very nice pdf output.
Took me a while to find it now (these services are all no longer in
use, alas) but here's the interesting parts, including MIME packing
...
MMENCODE=/usr/bin/mimencode
FAX2TIFF=/usr/bin/fax2tiff
TIFF2PS=/usr/bin/tiff2ps
PS2PDF=/usr/bin/ps2pdf
...
# Essential lines to put into the header of a MIME mail.
HEADERLINE_1="MIME-Version: 1.0"
HEADERLINE_2='Content-Type: multipart/mixed; boundary="attachment"'
# Lines to put into the header of each MIME attachment.
ATTACHMENT_HEADERLINE_1="--attachment"
ATTACHMENT_HEADERLINE_2="Content-Type: image/gif"
ATTACHMENT_HEADERLINE_2b="Content-Type: application/pdf"
ATTACHMENT_HEADERLINE_3="Content-Transfer-Encoding: base64"
# Line to close the attachment section of a MIME mail.
ATTACHMENT_ENDLINE="--attachment--"
...
# Fax2Tiff will "-R 98" als Schalter fuer "Hallo, niedrige Aufloesung"
STRETCH=""
RES=`basename $1 | sed 's/.\(.\).*/\1/'`
test "$RES" = "n" && STRETCH="-R 98"
# Nochmal alles als PDF
$FAX2TIFF $STRETCH -o /tmp/$REQNO.tif -M $@
$TIFF2PS -2 -a /tmp/$REQNO.tif >/tmp/$REQNO-in.ps
awk '/^showpage/ \
{ print "gsave /Courier-Bold findfont 14 scalefont setfont";
print "15 600 moveto 90 rotate ([Space.NET #'$REQNO']) ";
print "show grestore"; }
{print $0;} ' </tmp/$REQNO-in.ps >/tmp/fax-$REQNO.ps
( cd /tmp ; $PS2PDF fax-$REQNO.ps )
echo "$ATTACHMENT_HEADERLINE_1"
echo "$ATTACHMENT_HEADERLINE_2b; name=\"fax-$REQNO.pdf\""
echo "$ATTACHMENT_HEADERLINE_3"
echo ""
$MMENCODE </tmp/fax-$REQNO.pdf
echo ""
echo "$ATTACHMENT_ENDLINE"
(the awk manipulation of the .ps is only there to add the ticket
number on the right side of each page, it works fine without, just
run tiff2ps directly to the final .ps -> .pdf)
gert
--
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany
ge...@greenie.muc.de