Click here to Skip to main content
Email Password   helpLost your password?

Sample Image - Fax-XP-ing.gif

Introduction

This code can be used to send Faxes using Windows XP, 2000 or Above. 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.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralMy vote of 1
Shute312
18:47 30 Aug '09  
My god!
GeneralFax Application in Windows server 2003 and 2008.. this one is just in xp and 2k rite??
Amitsglja
0:51 4 Aug '09  
how to set it up in windows server 2003 and 2008 OS wil this code work in that also.. and are there any other steps to be done or execution of this code would directly do the fax work..
GeneralIs there license issue?
san_geit
1:04 3 Jul '09  
Nice Article!!

I have one question that if I add reference of my windows faxcomlib and I deploy the application to the other machine then will it any violation of license for window fax service?

Please rply asps.

Thanks
Sandeep
GeneralHow can we send a multipage tiff file?
samwiz
19:12 25 Apr '09  
Do we have to convert to bmp and send one page at the time? It would be nice to be able to do that in one go.
GeneralRe: How can we send a multipage tiff file?
Leon v Wyk
9:06 30 Apr '09  
I believe so. See one of the earlier posts, there is another reference you can add, this might give you better options with regards to multiple pages.

Leon v Wyk

QuestionException from HRESULT:0x8007000D
SedArash
21:52 10 May '08  
Hello,
I try to get the code below to work.
If I use test.tif it works just fine but all other extensions (pdf, txt, jpg
and so on) failing with "The data is invalid Exception from HRESULT:
0x8007000D".

I checked if the default setting for the extensions are correct and they are
assigned to notepad (txt) and acrobat reader (pdf) and Windows Picture and
Fax Viewer for (jpg).
I run Filemon and Regmon to see if there is an permission problem during the
click event but everything seems fine.
After the Error I have 2 events in my server logs.
Event ID 11
Document 4, 1C8673290FA2F - Notepad owned by NETWORK SERVICE was paused on
Fax.
Event ID 13
Document 4, 1C8673290FA2F - Notepad owned by NETWORK SERVICE was deleted on
Fax.


any suggestions what's wrong?


Regards
Anthony


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)


Try
Dim faxserver As FAXCOMLib.FaxServer
Dim faxdoc As FAXCOMLib.FaxDoc


faxserver = New FAXCOMLib.FaxServerClass
faxserver.Connect("")
faxdoc =
faxserver.CreateDocument("c:\inetpub\collecta\temp\test.tif") 'if ichange
the file to test.tif it works


faxdoc.RecipientName = "receiver"
faxdoc.FaxNumber = "2106741826"
faxdoc.DisplayName = "test"
faxdoc.Send()


faxserver.Disconnect()


Catch ex As Exception
Response.Write(ex.Message)
End Try


Error:
The data is invalid. (Exception from HRESULT: 0x8007000D)
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.


Exception Details: System.Runtime.InteropServices.COMException: The data is
invalid. (Exception from HRESULT: 0x8007000D)


Source Error:


Line 41: faxdoc.FaxNumber = "2106741826"
Line 42: faxdoc.DisplayName = "test"
Line 43: faxdoc.Send() (here the error occours)
Line 44:
Line 45: faxserver.Disconnect()


Source File: C:\Inetpub\collecta\Default.aspx.vb Line: 43


Stack Trace:


[COMException (0x8007000d): The data is invalid. (Exception from HRESULT:
0x8007000D)]
FAXCOMLib.IFaxDoc.Send() +0
collecta_Default.Button1_Click(Object sender, EventArgs e) in
C:\Inetpub\collecta\Default.aspx.vb:43
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
+107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaiseP­ostBackEvent(String
eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

Don't Worry ! Be Happy !
SedArash

AnswerRe: Exception from HRESULT:0x8007000D
Leon v Wyk
0:53 11 May '08  
I believe you need to convert the documents to Bitmaps (.bmp) and then pass the file path of the bitmap to the fax service.

Leon v Wyk

GeneralRe: Exception from HRESULT:0x8007000D
SedArash
2:23 11 May '08  
Dear Leon ,

I did so , however it failed again!

I solved my problem using FAXComExlib instead of FAXComlib. I believe it is more compatible with win XP usages than FAXComlib.

regards

Don't Worry ! Be Happy !
SedArash

GeneralRe: Exception from HRESULT:0x8007000D
sSupergirl
5:17 15 Aug '08  
SedArash, please help!

Where did you get a copy of FAXCOMEXLib.dll?

Where and how did you install it?

Thanks, Nina!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"...And then she'd say, it's Ok, I got lost on the way
but I'm a supergirl, and supergirls don't cry. ..."
Reamonn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GeneralRe: Exception from HRESULT:0x8007000D
Leon v Wyk
5:31 15 Aug '08  
Goto > Add and Remove Programs and Select Windows Components. Make sure you have Faxing Service installed. Once this is installed you will can add the reference into your project from the Com Components list.

Leon v Wyk

GeneralRe: Exception from HRESULT:0x8007000D
sSupergirl
6:03 15 Aug '08  
Thanks!
It was there, but I had to browse for it.
Rose

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"...And then she'd say, it's Ok, I got lost on the way
but I'm a supergirl, and supergirls don't cry. ..."
Reamonn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GeneralRe: Exception from HRESULT:0x8007000D
qiusongze
0:40 6 Oct '08  
i have encountered the same problem,how did u resolved this ,can u give some advice? if u have ,can u send it to me by email qiusz@bancomm.com.thanks
GeneralThe system can not find the file specified
Zapss
21:36 27 Jan '08  
I downloaded your application ,while am trying to send fax by using your demo program i received error "The system can not find the file specified".
I dint understand which File is missing?
and what type of file formats we can use to send fax?

please help me
GeneralFile Name + Fax Information
s3rro
5:16 25 Sep '07  
I have two questions:
1) Theres a generated file name at the top of the fax page each time a fax is send. Looks liek " 1c7ff7dc3122" how can I get rid of it?
2) The fax values at the top of the page such as the DATA, TIME, FROM: TO: PAGE:
I want to add From: Company Name, SenderPhoneNumber, Sender Name to the top of the page,

I added another txt field for the Company Name input and changed the function code :
public void SendFax(string DocumentName, string FileName, string RecipientName, string FaxNumber, string SenderNumber , string SenderName, string SenderCompany)
{
if (FaxNumber != "")
{
try
{
FAXCOMLib.FaxServer faxServer = new FAXCOMLib.FaxServerClass();
faxServer.Connect(Environment.MachineName);


FAXCOMLib.FaxDoc faxDoc = (FAXCOMLib.FaxDoc)faxServer.CreateDocument(FileName);

faxDoc.RecipientName = RecipientName;
faxDoc.FaxNumber = FaxNumber;
faxDoc.SenderFax = SenderNumber;
faxDoc.SenderName = SenderName;
faxDoc.SenderCompany = SenderCompany;

Now it read the SenderCompany, but it prints it out at the top of the page as;
FROM: Fax TheCompanyName

it doesnt print out the senderNumber ( I added a sendernumber input field too )
and the others, plues it prints the word "Fax" before the company Name.

I want to get rid of the "Fax" and want to add the other values to the top. Such as senderName, SenderPhone number etc.

Any solution?
GeneralRe: File Name + Fax Information
Leon v Wyk
7:26 25 Sep '07  
The 1c7ff7dc3122 text at the top of the page would be the document name I recon. It was probably creating a temp file and that is the name it used. I am not sure how you would add the other information to the page except for adding it to the document you are sending. If you use an image you can 'paint' the info in with System.Drawing class other than that sorry, not sure.

Leon v Wyk

GeneralRe: File Name + Fax Information
s3rro
4:54 26 Sep '07  
you already have a documentName text field in the application. But I couldn't find where that "1c7ff7dc3122" text comes from. I want to stop printing it.

If you can check and let me know that ll be great.

Thanks
GeneralUnknown Exceptional error
mast428
3:51 23 Jul '07  
Hi,
I am having a Brother Printer/fax machine. I tested your Demo program of sending a fax over it.
Before i go further, can i check if this program is to sent fax from a faxmachine(through the initative from PC) to another faxmachine, or is it sending a prompt to the fax maching attached through the PC?

I am trying to fax a single document to number of different destination faxes at a single prompt. So i though to modify your software if it works properly. But as for me when pressed sent button, it shows a error message "Unknown exception". Could you please help me out.
Thanks.
GeneralRe: Unknown Exceptional error
mast428
4:30 23 Jul '07  
And also could you please tell me the format of the Fax number.
As in with country code in front or with '+' and then country code?
GeneralProblem accessing FAXCOM from other service
LAcike@sk
6:20 28 Jun '07  
Hi!

In my application I need to send faxes. Everything works fine, but ...
Problem is, that I need to integrate my little application to service oriented system and run it as a windows service.

When I execute Connect() method from FaxServerClass, the service application hangs there until service startup timeout..
When I execute Connect method in standard windows application everything is fine.

I tried setting all permission to everybody on Fax. I also tried changing the call Connect(Environment.MachineName) to Connect(""). No resultsFrown


Please help
GeneralRe: Problem accessing FAXCOM from other service
Leon v Wyk
10:19 28 Jun '07  
The fax interface uses a user interface dialog (UI), try and enable 'desktop interaction' on your service. Hope that helps.

I don't think this is an security issue, but possibly, services need special permissions to access network resource or UNC paths, but the faxing should be local. Also keep in mind that you are calling a Desktop tool and not another service here. I might be a service handeling the actual faxing, but we are only instructing the windows faxing UI interace.

Leon v Wyk

GeneralRe: Problem accessing FAXCOM from other service
LAcike@sk
23:28 28 Jun '07  
I tried also 'desktop interaction', I forgot to mention that..

I set the permissions, because many people reported similar problems when using FS in web services or ASP.NET applications. It was issue with no permissions for CurrentUser - application starts in different user context than it is running in.

Somebody has to know answer for my question Smile


GeneralRe: Problem accessing FAXCOM from other service
Member 2169160
20:20 20 Jun '08  
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)
Member 2169160
20:22 20 Jun '08  
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
GeneralRe: Sending FAX using C#.net FAXCOMLib -The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8)
Leon v Wyk
4:55 21 Jun '08  
try using FAXComExlib instead FAXComLib.

Also, not sure if this works in a web interface.

Leon v Wyk

GeneralHow to receive fax messages?
alek_kowalczyk
22:22 17 Jul '06  
by using this faxcom.dll ???

--
alecc#


Last Updated 16 Sep 2004 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010