Click here to Skip to main content
15,867,308 members
Articles / Programming Languages / C#
Tip/Trick

Faxing with XP and C#

Rate me:
Please Sign up or sign in to vote.
2.42/5 (30 votes)
5 Jan 2014CPOL 281.2K   10.4K   49   54
Send faxes with C# using Win 2k or XP

Sample Image - Fax-XP-ing.gif

Introduction

This code can be used to send Faxes using Windows XP and 2000. I have included a bitmap image in the demo that will be faxed to a recipient. You can make your own bitmap using System.Drawing class, save it to disk and then reference it and send it to a fax number. All you need is a Modem, windows fax service which comes with XP and a telephone line and you are on you way. I understand that there might be some issues with limited User rights but have not yet tested it, I was only using my Administator Account when testing this. Anyway, all you might need to do is add a reference to the "faxcom 1.0 Libary" and you are set. Your feed back is welcome and I will keep track on any problems. 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Being IT Solutions
South Africa South Africa
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionin win 8 Pin
Angela 1029384829-Dec-13 19:26
Angela 1029384829-Dec-13 19:26 
GeneralMy vote of 4 Pin
William Croft24-Feb-11 11:05
William Croft24-Feb-11 11:05 
GeneralMy vote of 1 Pin
Shute31230-Aug-09 17:47
Shute31230-Aug-09 17:47 
QuestionFax Application in Windows server 2003 and 2008.. this one is just in xp and 2k rite?? Pin
Amitsglja3-Aug-09 23:51
Amitsglja3-Aug-09 23:51 
QuestionIs there license issue? Pin
san_geit3-Jul-09 0:04
san_geit3-Jul-09 0:04 
QuestionHow can we send a multipage tiff file? Pin
samwiz25-Apr-09 18:12
samwiz25-Apr-09 18:12 
AnswerRe: How can we send a multipage tiff file? Pin
Leon van Wyk30-Apr-09 8:06
professionalLeon van Wyk30-Apr-09 8:06 
QuestionException from HRESULT:0x8007000D Pin
SedArash10-May-08 20:52
SedArash10-May-08 20:52 
AnswerRe: Exception from HRESULT:0x8007000D Pin
Leon van Wyk10-May-08 23:53
professionalLeon van Wyk10-May-08 23:53 
GeneralRe: Exception from HRESULT:0x8007000D Pin
SedArash11-May-08 1:23
SedArash11-May-08 1:23 
GeneralRe: Exception from HRESULT:0x8007000D Pin
sSupergirl15-Aug-08 4:17
sSupergirl15-Aug-08 4:17 
GeneralRe: Exception from HRESULT:0x8007000D Pin
Leon van Wyk15-Aug-08 4:31
professionalLeon van Wyk15-Aug-08 4:31 
GeneralRe: Exception from HRESULT:0x8007000D Pin
sSupergirl15-Aug-08 5:03
sSupergirl15-Aug-08 5:03 
GeneralRe: Exception from HRESULT:0x8007000D Pin
qiusongze5-Oct-08 23:40
qiusongze5-Oct-08 23:40 
GeneralThe system can not find the file specified Pin
Zapss27-Jan-08 20:36
Zapss27-Jan-08 20:36 
GeneralFile Name + Fax Information Pin
s3rro25-Sep-07 4:16
s3rro25-Sep-07 4:16 
GeneralRe: File Name + Fax Information Pin
Leon van Wyk25-Sep-07 6:26
professionalLeon van Wyk25-Sep-07 6:26 
GeneralRe: File Name + Fax Information Pin
s3rro26-Sep-07 3:54
s3rro26-Sep-07 3:54 
GeneralUnknown Exceptional error Pin
mast42823-Jul-07 2:51
mast42823-Jul-07 2:51 
GeneralRe: Unknown Exceptional error Pin
mast42823-Jul-07 3:30
mast42823-Jul-07 3:30 
GeneralProblem accessing FAXCOM from other service Pin
LAcike@sk28-Jun-07 5:20
LAcike@sk28-Jun-07 5:20 
GeneralRe: Problem accessing FAXCOM from other service Pin
Leon van Wyk28-Jun-07 9:19
professionalLeon van Wyk28-Jun-07 9:19 
GeneralRe: Problem accessing FAXCOM from other service Pin
LAcike@sk28-Jun-07 22:28
LAcike@sk28-Jun-07 22:28 
GeneralRe: Problem accessing FAXCOM from other service Pin
dfordurai20-Jun-08 19:20
professionaldfordurai20-Jun-08 19:20 
Error while sending Fax from the C# applicaion

Error "The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8) "

How to get rid of the Above error. Any idea would be really appericated.

Code:

using System.Runtime.InteropServices;
using FAXCOMLib;

namespace FAX
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
FaxServer faxServer = new FaxServerClass();
faxServer.Connect(Environment.MachineName);
FaxDoc faxDoc =(FaxDoc)faxServer.CreateDocument(@"C:\TestDoc.txt");
faxDoc.FileName="C:\\TestDoc.txt";
faxDoc.SendCoverpage = 1;

faxDoc.CoverpageName = @"C:\TestDoc.txt";
faxDoc.CoverpageSubject = "Test Fax";
string bodyText = "This is a test" + Environment.NewLine;
bodyText += "list of products" + Environment.NewLine;
bodyText += "that should be on several lines";
faxDoc.CoverpageNote = bodyText;
faxDoc.RecipientName = "Test Recipient Name";
faxDoc.FaxNumber =FaxNumbr;
faxDoc.DisplayName = "TestFax";
faxDoc.SenderName = "Annadurai";
int iFaxJob = faxDoc.Send(); // Error occuring place
Response.Write(iFaxJob.ToString());
faxServer.Disconnect();
}
catch (Exception Ex)
{
Response.Write(Ex.Message);
}


}
}
}


Regards
Annadurai
GeneralSending FAX using C#.net FAXCOMLib -The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8) Pin
dfordurai20-Jun-08 19:22
professionaldfordurai20-Jun-08 19:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.