Link to home
Start Free TrialLog in
Avatar of ksbunger1
ksbunger1Flag for United States of America

asked on

Change Hylafax E-mail norification format

I need to change the format of the Hylafax E-mail notification for an inbound fax that is converted to an e-mail. I am converting the fax to a .pdf file.  I want to display the first page of the incoming fax in the e-mail notification alomg with the default information. I think this is controlled in Faxrcvd but I not see how to change it.
ASKER CERTIFIED SOLUTION
Avatar of Gabriel Orozco
Gabriel Orozco
Flag of Mexico image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ksbunger1

ASKER

I am very new at this awoudl ahve no ideaow to do this code ise do I need to provide the file so that youcudl give me a little more info please. ?
Hylafax can send attachments via email, being tiff or pdf

what you are asking is not supported by the package.

since Hylafax is mostly interpreted and shell scripts, I think it's easy to temper with it to make it do what you want, but it requires time and some knowledge.

what I told you before requires you to have some experience with linux. If you can't expend time on the learning curve, I would say it's better to say "Hylafax does not do that thing"...
I woudl prefer to do the learnng curve can you point me in the right direction for the shell scripts so I can understand then and i am sure I can do what you suggested first.
Let's see

you should already know Hylafax receives faxes and stores them as TIFF files. these are multi-page images.
since you send pdf files, this is how hylafax process the tiff file:
first step is convert them to postscript using a conversion program. result is a .ps file, using tiff2ps program
next step is convert the .ps to pdf using ps2pdf program.

you can extract the first page right before the tiff file is converted to postscript. it is not too dificult. you explode the tiff file using tiffsplit, and then you delete all pages but the first one. This leaves you with the original multipage tiif image and a tiff image containing just the first page.
 I think all the magic should be done at /var/spool/hylafax/bin/faxrcvd.

my approach would be to add a new FILETYPE value, with, say, "jpgpdf".
then add a function (or a binary) that extract the first page and convert it to jpg. In this step I think tiffsplit and an image processing program which accepts command line options like (I have not tested it) http://freshmeat.net/projects/xnview+nviewnconvert/. combining these two, you should be able to extract 1st. page and then convert to another format.

then copy the part dedicated to the "pdf" extension to another dedicated to the "jpgpdf" extension (the one we created)

it could be something like

         elif [ "$FILETYPE" = "jpgpdf" ]; then
            # jpg attachment
             echo "Content-Type: application/pdf; name=\"firstpage.jpg\""
             echo "Content-Description: JPG document"
             echo "Content-Transfer-Encoding: $ENCODING"
             echo "Content-Disposition: attachment; filename=\"firstpage.jpg\""
             echo ""
             convert1stpagetojjpg firstpage.jpg firstpage.tif
             encode firstpage.jpg
             $RM -f firstpage.jpg  2>$ERRORSTO

            # pdf attachment
             echo "Content-Type: application/pdf; name=\"$FILENAME.pdf\""
             echo "Content-Description: FAX document"
             echo "Content-Transfer-Encoding: $ENCODING"
             echo "Content-Disposition: attachment; filename=\"$FILENAME.pdf\""
             echo ""
             $TIFF2PDF -o $FILE.pdf $FILE
             encode $FILE.pdf
             $RM -f $FILE.pdf 2>$ERRORSTO
----------------------------------
Note the convert1stpagetojjpg function. you should create it using "encode" as a template
note the two attachments. first being the jpg image
note I'm reusing the same code as the pdf part
note I'm calling "firstpage.jpg" to the image of the first page.

I think it is all. I'm not doing the actual program, but am trying to orient you on how to do it. it's only the hack of one small bash script. hope it's clear enough for you.

Good Luck
Gabriel
Thaks I will be working on this tonight while the server isn't a traffic period.