Change Hylafax E-mail norification format

Posted on 2006-05-15
Medium Priority
Last Modified: 2008-01-09
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.
Question by:ksbunger1
  • 3
  • 3
LVL 19

Accepted Solution

Gabriel Orozco earned 1500 total points
ID: 16696430
I would add before the step where the tiff2ps process happends, the tiffsplit to a temporary location. then use the first page and delete all the others. then use a tool to convert from tiff to jpeg or the one you want (like http://freshmeat.net/projects/xnview+nviewnconvert/) and finally rename it to be something like 1stpage.gif (your extension).

when you reach the command to send the fax, you can modify to have both: 1stpage.jpg/gif/etc and the fax in pdf itself.

this is no easy but neither is too complex.


TIFFSPLIT(1)                                                                                        TIFFSPLIT(1)

       tiffsplit - split a multi-image TIFF into single-image TIFF files

       tiffsplit src.tif [ prefix ]

       tiffsplit  takes  a multi-directory (page) TIFF file and creates one or more single-directory (page) TIFF
       files from it.  The output files are given names created by concatenating a prefix, a  lexically  ordered
       suffix  in the range [aaa-zzz], the suffix .tif (e.g.  xaaa.tif, xaab.tif, xzzz.tif).  If a prefix is not
       specified on the command line, the default prefix of x is used.

Author Comment

ID: 16700833
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. ?
LVL 19

Expert Comment

by:Gabriel Orozco
ID: 16701295
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"...
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.


Author Comment

ID: 16705614
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.
LVL 19

Expert Comment

by:Gabriel Orozco
ID: 16705779
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

Author Comment

ID: 16713778
Thaks I will be working on this tonight while the server isn't a traffic period.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question