Hylafax Mailing List Archives

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

[hylafax-users] an outline of how to setup in a quick and dirty fashion a web based fax machine with thumbnails and PDFs



Using hylafax and a modified version of Uli Eckhardt's webview hylafax
scripts.  I have this setup on three machines which are mostly pentium 233
mmx based.  The pages come up fine, but not terribly snappy because of the
size of the pages with all of the largish thumbnails.  The
webfaxstuff.tar.gz I refer to is just a big tar ball of all of the rpms and
tars of all of the components that are needed or may be wanted.  I don't
have somewhere to post this right now, but when I figure something out, I
will you all know (if there is any interest).  All of this stuff is readily
available elsewhere and I have included the significant code changes below
as snippets.

Some things are total kludges and security holes (like symbolic links to var
and home from the webserver), but for me that doesn't matter because we have
a small office of people I trust and I accepted the first thing that came to
mind and worked and it works great.  Vnc is discussed for those who will
want to run headless/keryboardless as I do and with a baby-AT PC - its a
pretty small package to put anywhere.  The faxes are beautiful, super clean
and correctly sized and chopped thanks to the modified TIFF2PS that someone
(I am embarrased because I cannot remember who) posted in one of the mailing
lists.

My thanks to all those involved in bringing us hylafax and to Uli who saw
how easy it would be to put pages up on a webserver to answer the age old
question, "where did my fax go?"

mike

(this was originally written for someone with no experience at all with
Hylafax or Linux but did have Unix experience)

1. setup modem with a real chipset (no winmodems) on com2 or as known in
Linux ttyS1.

2. install rh 6.2 (with the following packages)
	custom install
	printer
	x-windows
	kde
	gnome
	networked workstation
	anonymous ftp
	emacs
	web server
	development
	kernel development
	utilities	
(get hylafax and webview.tar.gz  from hylafax.org)


3. install mawk from the rh cd
	rpm -ivh mawk*

4. untar webfaxstuff

4. copy all rpms and gz to usr/src from webfaxstuff

5. rpm -freshen ghost to upgrade to v6

6. edit /usr/lib/rhs/rhs-printfilters/printerdb and change lj4dith to ljet4d
since it was renamed in the new ghostscript

 7. /usr/src/rpm -freshen libtiff*

8 cp /webstuff/tiff2ps /usr/bin  &&&new tiff2ps you have the source code and
can change recompile if needed

9 /usr/share/ghostscript/ln -s 6.01 5.50

10. /usr/src/rpm -ivh hylafax*

11 faxsetup
	ignore egetty message
	accept all defaults
	start process
	add modem
	ttyS1 is com2 and ttyS0 is com1
	answer the obvious questions about phone numbers and name on the fax
machine
	change receive fax protection mode to 0666
	dte-dce control scheme I usually chnage to rtscts for hardware
handshake
	you will check the config later for all of the needed fax commands

12 add /usr/sbin/faxgetty ttyS1 & to rc.local

13 edit /var/spool/fax/etc/config.ttyS1 and chnage
		Modem dialCmd to say ATDT9,%s  to dial 9 
		if you have a class 1 modem make sure you have a
modemSetupAAcmd or it won't ever answer

14 cp /webfaxstuff/faxrcvd /var/spool/bin/ and overwrite

15 cp /webfaxstuf/httpd/* /home/httpd
16 chmod 755 /home/httpd/cgi-bin/show.pl
17 chmod 755 /home/httpd/cgi-bin/fax/*
18 edit /home/httpd/html/index.html and change the name "editorial" to
whatever you want
19 create a link /home/httpd/html/ln -s /var
20 edit /home/httpd/cgi-bin/show.pl and chnage $HOST to the correct address
21 check the page at http://your fax address
22 make a dns entry to give the fax machine a name
23 use printtool and create a n entry for lp2 which goes to a remote q and
has no filter and supresses headers
24 cp /webstuff/faxsetup to /var/spool/fax/recvq and use if you want to
control postscript printing or make it null or edit it out of show.pl and
faxrcvd
25 add user faxuser passwd faxuser
26 create a link /home/faxuser/ln -s /var
27 test it by sending a fax

28 install vnc (for a headless faxserver with kde)
	untar and copy vnc* Xvnc /usr/bin 
	run ./vncserver once so it will created default files
	kill it by running vncserver -kill :1	
	modify /root/.vnx/xsetup and change the last line to reads startkde
&
	add startup line to rc.local /bin/su root -c "/usr/bin/vncserver
-depth 24 :1"

29 if you have a time server running  install rpm -ivh xntp3* and use
linuxconf to make the following
	logs:date &time chnage get date from server to be your time server
	add the foloowing to the super user scheduler /usr/sbin/ntpdate
yourtimeserverip 
	*
	*
	*
	0,12
	5

30. if you need fancy printer control, the best approach I have found is to
setup a print job in windows and capture the print job to a file.  edit the
file and change the setting that you might need.  For example if you needed
to pull from tray 3, duplex, and output to the alternate bin face up, you
can do it. Printer control under Unix is crude at best and under Linux it is
stone age.  In the faxrcvd snipet below, I include the call to the
printersetup file that does just that.


for those that are familair with all fo this, the significant additions to
Hylafax are in the faxrcvd shown below.  added lines will create three
files: postscript file, gif thumbnail and PDF file.  Hylafax will
automatically clean up these files as it deletes off old files (how nice!).



faxrcvd
snip.....
PDFFILE="/var/spool/fax/recvq/"$BASENAME".pdf"
GIFFILE="/var/spool/fax/recvq/"$BASENAME".gif"

echo $BASENAME ' ' $TMPFILE1 ' ' $PDFFILE ' ' $GIFFILE
>/var/spool/fax/recvq/faxrcv.test

DEVICE="$2"
COMMID="$3"
MSG="$4"
if [ -f $FILE ]; then
###make PS file
         $TIFF2PS -pa1 -w8.5 -h10.875 -H14.0 -L0.5  $FILE -O $TMPFILE1
2>/dev/null
###print PS file
cat /usr/bin/printsetup $TMPFILE1 |lpr -Plp2
###make thumbnail
$TIFF2PS  -pa1 -w8.5 -h10.875 -H14.0 -L0.5 -s $FILE |gs -q -dNOPAUSE
-sDEVICE=pnm -dBATCH -sOutputFile=- - 2>/dev/null | /usr/bin/pnmscale -xsize
144 | /usr/bin/pnmdepth 31 |/usr/bin/ppmtogif >$GIFFILE
chmod 666 $GIFFILE
###make pdf
         $PS2PDF $TMPFILE1 $PDFFILE 2>/dev/null

snip......

and Nic's show.pl (this change basically shows you the thumbnail with a link
to the PDF of each fax received and puts the print/delete/view commands next
to each fax so you don't have to scroll so much)

snip....
sub makeline {
        local($file, $mode, $check) = @_;
        local($line, $sender, $pages, $received, $dataformat);
        $faxfile = "$FAXROOT/recvq/$file";
# BASENAME="`echo $FILE | perl -ne '($dir,$name)=split(/\//);print $name'`"
($BASENAME,$ext)=split(/\./,$file);
$PDFFILE='/var/spool/fax/recvq/'.$BASENAME.'.pdf';
$GIFFILE='/var/spool/fax/recvq/'.$BASENAME.'.gif';

        open(FINFO,"$FAXINFO -n $faxfile |");
        while(<FINFO>) {
                if ($_ =~ /\s*(\w*): (.*)/) {
                        switch: {
                                ($1 eq "Sender") && ($sender = $2, last
switch);
                                ($1 eq "Pages")  && ($pages = $2, last
switch);
                                ($1 eq "Received") && ($received = $2, last
switch);
                                ($1 eq "DataFormat") && ($dataformat = $2,
last switch);
                        }
                }
        }
        close FINFO;
        print "<TR>\n";
                print "<TD>";
        print "<INPUT Type=\"submit\" Name=\"mode\"
Value=\"View-$file\"><BR>\n";
        print "<INPUT Type=\"submit\" Name=\"mode\"
Value=\"Print-$file\"><BR>\n";
        print "<INPUT Type=\"submit\" Name=\"mode\"
Value=\"Delete-$file\">\n";
                print "</TD>";
if ($sender=='') {$sender="None given"};
print
"<TD>$sender</TD><TD>$pages</TD><TD>$received</TD><TD>$dataformat</TD>\n";
        if ($mode == 1) {
                print "<TD><A
HREF=\"ftp://faxuser:faxuser\@$HOST$PDFFILE\"><IMG BORDER=0
SRC=\"$GIFFILE\"></A></TD>";
        }
        print "</TR>\n";
}



snip...



____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null



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