Friday, May 11, 2007

I needed to add some simple, free FAX functionality to an application, so I invested a little time in doing it with Visual C# 2005 Express Edition.

Source from the web:

Resulting image:

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


Enjoy!

5/11/2007 4:21:20 PM (GMT Daylight Time, UTC+01:00)  #    Comments [3]  |  Trackback
Tracked by:
http://grillrestaurant.interactiveinfonet.info/grill-menu/bonefish-grill-menu-re... [Pingback]

5/22/2008 4:53:51 AM (GMT Daylight Time, UTC+01:00)
Great article! I have a question, however...where did you find that algorithm for the dithering? I have been scouring the internet and have not found one that is suitable for my situation. I have a grayscale image (black, white and RGB(223,233,223) are the only colors) that I am converting to a bitonal image. The problem is that I cannot find a dithering algorithm that will help it so I can get it to compress well enough. I have implemented the Floyd-Steinberg dither (source from the tiffdither tool from libtiff.org) which does a nice job, but the gray areas could be spread out a bit more. I have examples that illustrate what I'm talking about:

What I have (w/Floyd-Steinberg) - http://leviwilson.com/what_i_have.PNG

What I need (from a TIFF print driver) - http://leviwilson.com/what_i_need.PNG

Any insight would be greatly appreciated (as I am new and cannot tell what type of algorithm the second one is).

Thanks!
5/23/2008 2:49:20 AM (GMT Daylight Time, UTC+01:00)
Hi Levi,

That's my limit of graphics knowledge at this point. I haven't had to do much else. I suppose you could do a simple toggle of a boolean if it is (223, 233, 223), or perhaps something to make it every third (fourth, whatever) bit.

Eric
eric
3/11/2009 11:04:16 AM (GMT Standard Time, UTC+00:00)
This is a TEST Comment
Salman Khan
http://www.google.com/
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Theme design by Jelle Druyts

Pick a theme: