Change Hylafax E-mail norification format

Posted on 2006-05-15
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
    LVL 19

    Accepted Solution

    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 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

    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

    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"...

    Author Comment

    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

    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) 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

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

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
    Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
    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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now