I needed to add some simple, free FAX functionality to an application, so I invested a little time in doing it with Visual Studio Express Edition.
I decided to make it use web browser content; seeing that it’s pretty easy to format a web page, no FAX imaging tools are required. Thanks to Michael McCloskey’s Bitonal article Bitonal (TIFF) Image Converter for .NET, I was able to accomplish my goal rather easily!
I added in some random dithering to produce a decent balance between text pages and pages with images. I was tempted to implement Floyd-Steinberg Dithering, but my random results are good enough for my project.
I also added in code for generating the image from a web page, and creating the multi-page TIFF document.
I reference FaxComEx.dll, the Windows FAX server, in the code. This makes it easy to generate a FAX by the command line, (e.g. Url2Fax http://localhost/reportapp/report.jsp?repnum=1 18885551212 FAXSVR100 will send a report to 8885551212, using the fax printer on FAXSVR100 (don’t use “localhost”)) If you don’t want to use the FAX service, leave off the parameters. You can grab the image from your %TEMP% directory.
Here’s the source code: Url2Fax.zip. The exe is located in the release folder, in case you want to try it as is. You’ll need Windows XP or 2003 to use the built-in Fax delivery. For Windows 2000, you can generate the image and then send it with the Windows 2000 fax server. (I have a script for that, too).