Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] Adding the cover page to the returned email..



I have actually ended up following advice given, and recompiled WHFC with
the option to "Send as doc".

If anybody needs to see the sources I am happy to share. As they are
customised to my client's needs you will need to recompile with your own
mods. However I can also be persuaded to compile a more generic form,
provided nobody expects me to warrant my work, as I am, at best, a self
confessed, "Cut 'n' paste" coder.

Olly

-----Original Message-----
From: DA @ IMPACT [mailto:DA@xxxxxxxxxxxxxxxxxx]
Sent: 28 November 2004 16:33
To: 'Olly'; 'Andreas Fricke'
Subject: RE: [hylafax-users] Adding the cover page to the returned
email..


How about this script (simpler??) for a faxsend.custom with SendFaxCmd:
etc/faxsend.custom

Could you guys try this one out on your systems and let me know If it
works?

------
#! /bin/sh
# custom faxsend that will combine any .cover with the .ps file of the
job.
#
#  At this point in the process, the ps files have already been prepared
by faxq into the
#  required tiff files for transmission.  So, all we need to do here is
to combined the
#  cover.ps file with the document.ps file into a single ps file (the
document ps file).
#  We have to combine them before we acutally call the real faxsend.
#  The cover.ps will be removed later by the real faxsend.
#  Whatever remains in the document.ps file will get returned by the
notify script.
#
#  There is no need to modify the qfile or to delete any other ps files
ourselves here.
#

#  LIMITATIONS:
#  we are going to have to do some more work if there is anyting but .ps
files being submitted.
#  or if there are more than on .cover or 1 .ps file submitted per job.
#  if there is more than one qfile at the end, they others will not get
processed correctly by
#   this script

NUMARGS=$#
QFILE=${!NUMARGS}

# Is there a cover listed in the qfile ?
QFILECOVERLINE="`cat "$QFILE" | grep ":docq.*.cover"`"
if [ $? -eq 1 ]; then
    # no cover for this fax
    # do nothing. here and just call c2faxsend with original args
    :
else
    # YES there is a cover file
    # What's the name of the fax doc listed in the qfile?
    QFILEDOCLINE="`cat "$QFILE" | grep ":docq.*.ps"`"
    PSDOCFILE="`echo "$QFILEDOCLINE" | cut -d":" -f4`"
    PSCOVERFILE="`echo "$QFILECOVERLINE" | cut -d":" -f4`"
    TMPFILE="tmp/$$.coverplusdoc"
    #  now combine the cover and the doc file into one file and then use
the combined file
    cp "$PSCOVERFILE" "$TMPFILE"
    cat "$PSDOCFILE" >> "$TMPFILE"
    cat "$TMPFILE" > "$PSDOCFILE"  # do a cat vs mv incase files are
ever linked
#    rm "$TMPFILE"
fi

# Call the original faxsend command with whatever this sript was called
with.
/usr/sbin/faxsend $*

# Exit, and don't forget the status
exit $?

------

Frank Brock




-----Original Message-----
From: hylafax-users-bounce@xxxxxxxxxxx
[mailto:hylafax-users-bounce@xxxxxxxxxxx] On Behalf Of Olly
Sent: Monday, November 08, 2004 11:13 AM
To: 'Andreas Fricke'
Cc: hylafax-users@xxxxxxxxxxx
Subject: Re: [hylafax-users] Adding the cover page to the returned
email..

Thanks Fricke,
I will try this out ASAP, even so I am sure you have given me enough to
work
with.

Thanks again.

:)

-----Original Message-----
From: Andreas Fricke [mailto:andreas.fricke2@xxxxxxxxxxxxxxxxxxxxxxxx]
Sent: 08 November 2004 14:39
To: Olly
Subject: Re: [hylafax-users] Adding the cover page to the returned
email..


Hi Olly,

for adding the cover to the fax I wrote and changed some scripts. It's
not very elegant, but it's working :-)

*Step 1:*
Write a new script and past it "between" hfaxd and the command which is
responsible for sending a fax. This is normally defined in etc/config:
<SNIP>
SendFaxCmd:            /usr/local/bin/c2faxsend
</SNIP>

Replace this entry with the new script, i.e.
#SendFaxCmd:            /usr/local/bin/c2faxsend
SendFaxCmd:            /usr/local/bin/c2faxsend_new

The new script should contain:

# What's the name of the fax?
NOTIFY_TEMP_01="`cat $3 | grep ":docq/doc"`"
# Is there a cover?
NOTIFY_TEMP_02="`cat $3 | grep -c ".cover"`"
if [ $NOTIFY_TEMP_02 == "1" ]; then
    # NO
    PSFILE="`echo $NOTIFY_TEMP_01 | cut -d":" -f4`"
else
    # YES
    PSCOV1="`echo $NOTIFY_TEMP_01 | cut -d":" -f4`"
    PSCOV2="`echo $PSCOV1 | cut -d" " -f1`"
    PSCOVR="/var/spool/fax/$PSCOV2"
    # Make a copy of the cover with an unambiguous filename
    NOTIFY_TEMP_03="`cat $3 | grep "killtime:" | cut -d":" -f2`"
    cp /var/spool/fax/$PSCOV2
/var/spool/fax/tmp/"$NOTIFY_TEMP_03"BYc2fs_Covr.ps
fi
# Call the original faxsending - command
# $1: parameter "-m"
# $2: Device-ID
# $3: qfile

/usr/local/bin/c2faxsend "$1" "$2" "$3"
# Exit, and don't forget the status
exit $?


*Step 2:*
Modify your bin/notify:
<SNIP>
# Name of the log-file
QFILE=$1
# Is there a cover?
NOTIFY_TEMP_02="`cat $QFILE | grep -c ".cover"`"
if [ $NOTIFY_TEMP_02 == "1" ]; then
    # NO
    PSFILE="`echo $NOTIFY_TEMP_01 | cut -d":" -f4`"
else
    # YES
    NOTIFY_TEMP_01="`cat $QFILE | grep ":docq/doc"`"
    # What's the name of the fax?
    PSFILE="`echo $NOTIFY_TEMP_01 | cut -d":" -f7`"
    # Rebuild the name of the cover-page
    NOTIFY_TEMP_04="`cat $QFILE | grep "killtime:" | cut -d":" -f2`"
    PSCOVR=/var/spool/fax/tmp/"$NOTIFY_TEMP_04"BYc2fs_Covr.ps
    # Create the new fax including the cover
    cat $PSCOVR > /var/spool/fax/tmp/faxfinished.ps
    cat $PSFILE >> /var/spool/fax/tmp/faxfinished.ps
    PSFILE=/var/spool/fax/tmp/faxfinished.ps
fi
# Build the new pdf-file
/usr/bin/ps2pdf13 "$PSFILE" /var/spool/fax/tmp/faxfinished.pdf
1>/dev/null 2>/dev/null
</SNIP>

Et voilà, there's the fax including the coverpage!

I hope that's useful!

Greetings
Andreas Fricke


--
Olly schrieb:

> Hi
>
> I've managed to set up Hylafax 4.2.0 with email notification faxes, in
PDF
> format, to the senders, and the Admin.
>
> So far so good.
>
> However the client is a Law firm, and they require the entire fax to
be
> returned to them in the PDF. Including the customised cover page.
>
> My question:
>
> How can I add the cover page to the files that are returned in the
email?
>
> Thanks.
>
> Olly
>
>
> ____________________ HylaFAX(tm) Users Mailing List
_______________________
>   To subscribe/unsubscribe, click
http://lists.hylafax.org/cgi-bin/lsg2.cgi
>  On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx <
/dev/null
>   *To learn about commercial HylaFAX(tm) support, mail
sales@xxxxxxxxx*
>
>
>


____________________ HylaFAX(tm) Users Mailing List
_______________________
  To subscribe/unsubscribe, click
http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx <
/dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.801 / Virus Database: 544 - Release Date: 24/11/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.801 / Virus Database: 544 - Release Date: 24/11/2004



____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services