HylaFAX The world's most advanced open source fax server

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

Re: [hylafax-users] Attachments sent from outlook not displaying



This is my application/octet-stream filter.
I used this to separate between Office files, PDF, ASCII and Postscript & feed them to its own PS processor.
No guarantee that it's fool-proof, though it works nicely enough for me.

Note: You can find definition of filter.pl & xvfb-run elsewhere in this list.
If you need to print GIF JPEG, there is another sample good application/octet-stream in the list archive.

Cheers!
James

######################### application/octet-stream ##########################
#!/bin/sh
FILETYPE=`file $1 | cut -d ":" -f 2- | awk '/Microsoft Office/ { print "office" }; /PDF/ {print "pdf"}; /ASCII/ {print "ascii"}; /PostScript/ {print "ps"};  '`
#echo $FILETYPE
if [ "$FILETYPE" = "office" ] ; then
    #if it's MS-Office doc, then convert it
    /bin/echo " "
    /bin/echo "showpage"
    /usr/bin/xvfb-run -a -f /var/spool/hylafax/.XAuthority /opt/openoffice.org2.0/program/soffice -headless -p $1 | /usr/sbin/faxmail/filter.pl 

elif [ "$FILETYPE" = "pdf" ] ; then
    #if it is PDF, then convert it
    /bin/echo " "
    /bin/echo "showpage"
    gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pswrite "-sOutputFile=-"  -c save pop -f "$1" | /usr/sbin/faxmail/filter.pl 

elif [ "$FILETYPE" = "ascii" ] ; then
    #if it's a text file in disguise, convert it
    /bin/echo " "
    /bin/echo "showpage"
    a2ps -1 -B -o - < $1 | /usr/sbin/faxmail/filter.pl

elif [ "$FILETYPE" = "ps" ] ; then
    #if it's postscript, print it out directly
    /bin/echo " "
    /bin/echo "showpage"
    cat $1 | /usr/sbin/faxmail/filter.pl 

fi 
######################### end of file ##########################


-----Original Message-----
From: hylafax-users-bounce@xxxxxxxxxxx [mailto:hylafax-users-bounce@xxxxxxxxxxx] On Behalf Of Neil Doody
Sent: Thursday, June 15, 2006 6:20 PM
To: Lee Howard; Neil Doody
Cc: hylafax-users@xxxxxxxxxxx
Subject: Re: [hylafax-users] Attachments sent from outlook not displaying

> You'll have to set up a mimetype for application/octet-stream which,
> after mime-decoding it, determines the filetype independently... perhaps
> just from the filename extension as Microsoft intended.
> 
> Lee.

I was looking at filename extension, only $1 represents the filename of a
temporary file generated by faxmail that contains the extracted data to be
converted.  I am in the process of looking for an application which can
decode files and detect there file type, any ideas?

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




Project hosted by iFAX Solutions