216 lines
8.7 KiB
HTML
216 lines
8.7 KiB
HTML
<!--startcut ==============================================-->
|
|
<!-- *** BEGIN HTML header *** -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML><HEAD>
|
|
<title>Virtual fax to pdf files with EFax.com LG #58</title>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
|
ALINK="#FF0000">
|
|
<!-- *** END HTML header *** -->
|
|
|
|
<CENTER>
|
|
<A HREF="http://www.linuxgazette.com/">
|
|
<H1><IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.jpg"
|
|
WIDTH="600" HEIGHT="124" border="0"></H1></A>
|
|
|
|
<!-- *** BEGIN navbar *** -->
|
|
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="nielsen.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue58/nielsen2.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="okopnik.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
|
|
<!-- *** END navbar *** -->
|
|
<P>
|
|
</CENTER>
|
|
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4 ALIGN="center">
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
<center>
|
|
<H1><font color="maroon">Virtual fax to pdf files with EFax.com</font></H1>
|
|
<H4>By <a href="mailto:python@kepnet.com">Mark Nielsen</a></H4>
|
|
</center>
|
|
<P> <HR> <P>
|
|
|
|
<!-- END header -->
|
|
|
|
|
|
|
|
|
|
<ol>
|
|
<li>
|
|
<a href="#REF">References</a></li>
|
|
|
|
<li><a href="#Introduction">Introduction</a></li>
|
|
<li><a href="#Service">Getting the fax number</a></li>
|
|
<li><a href="#Email">What is in the email?</a></li>
|
|
<li><a href="#Tiff">What do we do with the tiff files?</a></li>
|
|
<li><a href="#Scripts">Scripts.</a></li>
|
|
|
|
|
|
<li>
|
|
<a href="#Conclusion">Conclusion</a></li>
|
|
</ol>
|
|
|
|
<hr WIDTH="100%">
|
|
<h3>
|
|
<a NAME="REF"></a>References</h3>
|
|
|
|
<ol>
|
|
<li> <a href="http://www.informatik.uni-frankfurt.de/~fp/uudeview/Apps/">
|
|
http://www.informatik.uni-frankfurt.de/~fp/uudeview/Apps/</a></li>
|
|
</ol>
|
|
|
|
<h3>
|
|
<a NAME="Introduction"></a>Introduction</h3>
|
|
The idea is very simple. Sign up with a fax service which provides
|
|
you a phone number and they will forward all faxes to that number to
|
|
you in the form of email. Take the fax in the email and convert it into
|
|
a pdf file on your webserver so that you can download, or perhaps have it
|
|
automatically dump the fax to a printer. <p>
|
|
This is very nice if you want to create a virtual office. Many a independent
|
|
consultant might be interested in this.
|
|
|
|
<h3>
|
|
<a NAME="Service"></a>Getting the fax number</h3>
|
|
|
|
Go to <a href="http://www.efax.com/signup/free_signup.html">efax.com</a>.
|
|
You can figure it out. Just get their free basic account. I believe there
|
|
are other free fax services out there, but I have looked around a lot.
|
|
|
|
<h3><a NAME="Email"></a>What is in the email?</h3>
|
|
|
|
The email you receive will contain tiff formatted graphic files. They
|
|
are converted to text in the email. You will need a program to extract the
|
|
tiff files out of the email and convert the tiff files from text back to
|
|
binary.
|
|
<p>
|
|
Once you have extracted the tiff files out of the email messages, you can
|
|
do with them whatever you want. For this article, we will convert them
|
|
to pdf files and put them in a web directory for easy download.
|
|
|
|
<h3><a NAME="Tiff"></a>What do we do with the tiff files?</h3>
|
|
|
|
Okay, you need a program called uudeview, or some other program, which
|
|
will easily extract the tiff files out of the email messages. Then, you
|
|
will need to convert the tiff files to postscript. Then you will need
|
|
to convert the postscript files to pdf. Then you will need to put the
|
|
pdf files in a web directory. Here is an example of how to do this,
|
|
|
|
<pre>
|
|
### Copy the mail over to a temporary file.
|
|
cp /var/spool/mail/Username File.mail
|
|
### Extract the tiff files.
|
|
uudeview File.mail
|
|
### Let us assume the tiff file is extracted as the name MyFile.tiff
|
|
### Convert it to postscript
|
|
tiff2ps MyFile.tiff > TempFile.ps
|
|
### Convert it to pdf
|
|
ps2pdf TempFile.ps TempFile.pdf
|
|
### move it
|
|
mv TempFile.pdf /www/docs/pdf/TempFile.pdf
|
|
</pre>
|
|
|
|
That is how you can do it manually. However, we want to automate the process.
|
|
Two scripts in the next section will do that.
|
|
|
|
<h3><a NAME="Scripts"></a>Scripts</h3>
|
|
These scripts clean up temporary files. You may not want to delete
|
|
the email messages, in which case, someone will have to modify this perl
|
|
script.
|
|
(<A HREF="misc/nielsen/faxscript.pl.txt">text version</A>)
|
|
<pre>
|
|
#!/usr/bin/perl
|
|
|
|
## We assume you have uudeview installed.
|
|
## We assume you have a public_html directory which your webserver has been
|
|
## properly configured to see.
|
|
|
|
### This perl script is not properly secured since it is possible to make
|
|
### a weird configuration for the name of the fax file, which in theory
|
|
### could mess up the command line statements. Use at your own risk.
|
|
|
|
my $User = "Mu_Username";
|
|
my $Temp = "/home/$User/Temp/fax";
|
|
|
|
system "cp /var/spool/mail/$User /home/$User/Temp/";
|
|
system "cp /dev/null /var/spool/mail/$User";
|
|
system "/usr/bin/uudeview -o -i -d -p /home/$User/tiff/ /home/$User/Temp/fax";
|
|
system "cp /dev/null /home/$User/Temp/fax";
|
|
|
|
my @Old_Pdfs = </home/$User/public_html/pdf/*.pdf>;
|
|
my $No = @Old_Pdfs;
|
|
|
|
foreach my $File (</home/$User/tiff/*.tif>)
|
|
{
|
|
$No++;
|
|
my $Ps = $File;
|
|
$Ps =~ s/\.tif/\.ps/g;
|
|
$Ps =~ s/tiff/ps/;
|
|
system "/usr/bin/tiff2ps $File > $Ps";
|
|
|
|
### If you want to print this, uncomment
|
|
# system "lpr $Ps";
|
|
|
|
my $Pdf = $Ps;
|
|
$Pdf =~ s/\.ps/\.pdf/g;
|
|
system "/usr/bin/ps2pdf $Ps $Pdf";
|
|
|
|
### Either choose to keep the default name of the file or number it
|
|
# system "mv $Pdf /home/$User/public_html/pdf/";
|
|
system "mv $Pdf /home/$User/public_html/pdf/$No.pdf";
|
|
|
|
system "rm $Ps $File;";
|
|
}
|
|
</pre>
|
|
|
|
Here is the crontab file you will need. run the command
|
|
<pre>
|
|
crontab Crontab
|
|
</pre>
|
|
in order to get to be automated.
|
|
|
|
<pre>
|
|
#!/bin/sh
|
|
|
|
0,15,30,45 * * * * /home/UserName/Cron.pl >> /home/UserName/cron_log 2>&1
|
|
|
|
</pre>
|
|
|
|
<h3><a NAME="Conclusion"></a>Conclusion</h3>
|
|
|
|
This is very easy way to get your virtual fax to be automated and converted
|
|
into something that is easy to read. Having a virtual fax number is nice
|
|
because it saves you money by not having to have a phone number.
|
|
Every roaming consultant needs this. <p>
|
|
Phil Hunter from <a href="http://www.colug.net">COLUG</a> first told
|
|
me about this a year or two ago. He just dumps the faxes to a printer.
|
|
It wasn't of much use then when
|
|
I had an office and a fax machine, but I have
|
|
found it useful since I moved out to California. My next goal is to
|
|
send a fax through a modem, and then I will be able to send and receive
|
|
faxes when I am not in my office in the Bay Area.
|
|
|
|
|
|
|
|
|
|
<!-- *** BEGIN copyright *** -->
|
|
<P> <hr> <!-- P -->
|
|
<H5 ALIGN=center>
|
|
|
|
Copyright © 2000, Mark Nielsen<BR>
|
|
Published in Issue 58 of <i>Linux Gazette</i>, October 2000</H5>
|
|
<!-- *** END copyright *** -->
|
|
|
|
<!--startcut ==========================================================-->
|
|
<HR><P>
|
|
<CENTER>
|
|
<!-- *** BEGIN navbar *** -->
|
|
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="nielsen.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue58/nielsen2.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="okopnik.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
|
|
<!-- *** END navbar *** -->
|
|
</CENTER>
|
|
</BODY></HTML>
|
|
<!--endcut ============================================================-->
|