Sending fax to network fax-printer
Hi,
I have the RICOH Aficio 2018D device which can be used to send fax. It is installed as a network fax-printer in my LAN. I want to write an application that will send faxes using this device. Can I use the FAXCOMLib for this purpose or it is only for fax-modems?
I tried to use it. The code was:
FaxServer faxServer = new FaxServerClass();
faxServer.Connect("MICHAELB2"); // It's my PC's hostname
FaxDoc doc = (FaxDoc)faxServer.CreateDocument(@"C:\Dmitryp\FAX.NET\test.doc");
doc.FaxNumber = "12345678";
doc.RecipientName = "Me";
doc.Send();
faxServer.Disconnect();
This throws the COM exception on line "doc.Send();". The exception is:
"The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8)"
Well, I tried to pass the fax-printer hostname to Connect() method, but then I god another exception, again on the same line "doc.Send();":
"The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))"
Any ideas?
Re: Sending fax to network fax-printer
Hi Dmitry,
I also need to fax from visual basic to network fax printer.
Have you found any way to do this?
Thanks in advance.
sharad
Re: Sending fax to network fax-printer
Is the type FaxServer an interface or a base class?
Quote:
Originally Posted by Dmitry Perets
FaxServer faxServer = new FaxServerClass();
Also, did you try the fully qualified name for your computer (e.g., including the domain name)?
Quote:
Originally Posted by Dmitry Perets
faxServer.Connect("MICHAELB2");
I think if you successfully connect to the fax server, it'll go a lot further. . .
Re: Sending fax to network fax-printer
Did any of you guys find a solution for this , i get into the same issue
here is the code that im using
FaxServerClass fs = new FaxServerClass();
fs.Connect("XXXXX"); //specifies the machinename
object obj = fs.CreateDocument(file);
FaxDoc fd = (FaxDoc)obj;
fd.FaxNumber = "XXXXXXXXXXX";//will be replaced with the proper fax number
fd.RecipientName = "Tester";
fd.Send();
fs.Disconnect();
The error that i get is
System.Runtime.InteropServices.COMException was unhandled
Message="The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8)"
Source="Interop.FAXCOMLib"
ErrorCode=-2147020584
StackTrace:
at FAXCOMLib.IFaxDoc.Send()
at SampleFaxApplication.Form1.button2_Click(Object sender, EventArgs e) in C:\Documents and Settings\pakula\My Documents\Visual Studio 2008\Projects\SampleFaxApplication\SampleFaxApplication\Form1.cs:line 54
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at SampleFaxApplication.Program.Main() in C:\Documents and Settings\pakula\My Documents\Visual Studio 2008\Projects\SampleFaxApplication\SampleFaxApplication\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
in this case im trying to fax a simple tecxt doc .
any help would be greatly appriciated.
Thanks
Pavan
Re: Sending fax to network fax-printer
Caveat: I've never tired this before.
This post (link; see accepted solution) say the key parameters to set are FileName and FaxNumber... So maybe you should modify your code to be like:
Code:
FaxServerClass fs = new FaxServerClass();
fs.Connect("XXXXX"); //specifies the machinename
object obj = fs.CreateDocument(file);
FaxDoc fd = (FaxDoc)obj;
fd.FaxNumber = "XXXXXXXXXXX";//will be replaced with the proper fax number
fd.RecipientName = "Tester";
fd.FileName = //you fill it in;
fd.Send();
fs.Disconnect();
Like I said though, I've not done that before.