FAXCOMLib

Has anyone had any luck to get faxing working with C# Here is the code I have

using System;
using FAXCOMLib;

namespace ConsoleApplication3
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{


public Class1()
{

}

public void FaxDocument(String TheFile, string faxnumber)
{
FAXCOMLib.FaxServer server = new FaxServerClass();
FAXCOMLib.FaxDoc doc = null;
int response = -11;

try
{
server.Connect(Environment.MachineName);
}
catch(Exception e)
{
System.Console.WriteLine("1"+e.Message);
}

try
{
doc = (FAXCOMLib.FaxDoc)server.CreateDocument(TheFile);
}
catch(Exception e)
{
System.Console.WriteLine("doc error"+e.Message);
}

try
{
doc.FaxNumber = faxnumber;
doc.RecipientName = "Test";
doc.DisplayName = "work";
}
catch(Exception e)
{
System.Console.WriteLine("assignments" + e.Message);
}


try
{

response = doc.Send();
}
catch(Exception e)
{
System.Console.WriteLine( response + e.Message);
}

try
{
server.Disconnect();
}
catch(Exception e)
{
System.Console.WriteLine("2"+e.Message);
}



System.Console.WriteLine("w00t");

}


/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{

Class1 objcsFax = new Class1();
objcsFax.FaxDocument("C:\\test.txt", "8067");
}
}
}


Answer this question

FAXCOMLib

  • Simon Heffer

    well sorry that they didnt help you

    anyway.. while searching i found sites that offer real good api`s for fax but they are for sale.. and i dont think you want it on money..


  • FassaBortolo

  • Mike Culver

    That faxing with XP and C# is actually what i developed that sample code from, and that other site u posted is a third party service. I would like to cut out the middle man.

  • james_cline_

    I got that code to work ! The two problems were as follows:

    1) I am idiot. I though I had show file extensions on so when I created the test.txt file I had an extra .txt on it, so the file name was really test.txt.txt and no test.txt.

    2) The sample code is provided with a BMP as a test page. The application says invlaid data with it because it perfers text files over BMPs. I dont know why I am goin to look into more why it isnt enjoying BMPs.

  • dtlinker

    Visit this site perhaps it can help you

    http://www.dotnetspider.com/technology/kbpages/680.aspx

    FAXCOMLib don’t exist in my framework Help me .



  • JRQ

    Hi may need you guys help out, how to return the status printing

    How to use Dim status As FAXCOMLib.FaxStatus

    Public FaxServer As Object

    Public FaxDoc As Object

    Public IND As Integer

    Public strStatus As String

    Try

    Dim fo As New OpenFileDialog()

    fo.Filter = "Microsoft Word Document (*.doc)|*.doc| Adobe PDF (*.pdf)|*.pdf"

    If fo.ShowDialog = Windows.Forms.DialogResult.OK Then

    If fo.FileName = "" Then

    Exit Sub

    End If

    Else

    Exit Sub

    End If

    Dim fxsvr = New FAXCOMLib.FaxServer()

    Dim fxdoc = fxsvr.CreateDocument(fo.FileName)

    Dim status As FAXCOMLib.FaxStatus

    Dim fxport = New FAXCOMLib.FaxPort

    Try

    fxsvr.Connect("nb-039") 'Machine Name

    Catch ex As Exception

    MessageBox.Show(ex.ToString())

    End Try

    fxdoc.FileName = fo.FileName

    fxdoc.FaxNumber = InputBox("Fax Number:", "Enter Fax Number", -1, -1)

    fxdoc.RecipientName = ""

    Try

    IND = fxdoc.Send()

    'strStatus = status.Send()

    MsgBox(IND)

    MsgBox(strStatus)

    Catch ex As Exception

    MessageBox.Show(ex.ToString())

    End Try

    fxsvr.Disconnect()

    Catch ex As Exception

    MessageBox.Show(ex.Message() & ControlChars.CrLf & ControlChars.CrLf & ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

    End Try


  • FAXCOMLib