Call to ConnectedSubmit () results in a "Select Printer" dialog box.

  • Thread starter Thread starter Jonny
  • Start date Start date
J

Jonny

I'm trying to use ConnectedSubmit() from .NET, but when I do so it
pops up a dialog box prompting me to choose a Fax Printer. If I just
hit the Print button (it has the fax already selected), it proceeds
normally, but I want the code to work without prompting a user to hit
print.

The code is below, nothing special about it :-)

Many thanks in advance,

J.

public void FaxReport(string faxTo, string reportName, string
reportDescription, string outputFilename)
{
FAXCONTROLLib.FaxControl faxControl = new
FAXCONTROLLib.FaxControlClass();

log.Debug("Is fax service installed? " +
faxControl.IsFaxServiceInstalled.ToString());
log.Debug("Is local fax printer installed? " +
faxControl.IsLocalFaxPrinterInstalled.ToString());

FAXCOMEXLib.FaxServer faxServer = new FaxServerClass();
faxServer.Connect(null);

FAXCOMEXLib.FaxDocument faxDoc = new
FAXCOMEXLib.FaxDocumentClass();
faxDoc.Recipients.Add(faxTo, "Somebody");

faxDoc.Body = outputFilename;
faxDoc.DocumentName = "Doco Name";

faxDoc.Sender.Name = "Bob";
faxDoc.Sender.BillingCode = "2A345";
faxDoc.Sender.Department = "Accts Payable";
faxDoc.Sender.FaxNumber = "+353 (1) 555 5555";

object obj = faxDoc.ConnectedSubmit(faxServer);

faxServer.Disconnect();
}
 
Which account are you invoking the fax service under? Is it the same as your
user account of perhaps you are doing it from a service or ASP.NET page?

FWIW nearly identical code works fine for me (also C#). The only thing I do
differently is faxServer.Connect("") instead of faxServer.Connect(null), but
that shouldn't matter. I suspect that the profile for the account being used
does not have a default fax printer specified, or is missing something else
 
At the moment I'm invoking the fax service from my own local account.
It's going to run as part of a nightly shceduled task, so in theory I
can run it from under any account if I wish.

So how do you specify a default fax printer? I had a quick hunt
around and couldn't see anything.

Something I completely ommitted to mention in my previous post, and so
apologies now, but I'm actually using Windows XP to send a fax and not
Windows 2000. My fault for posting to the Windows 2000 newsgroup.
I'll go post on the WinXP board if I can't resolve the issue here.
 
I have made some progress on this problem - and it appears to affect
both W2k and XP users.

When I send a .txt file to the fax using ConnectedSubmit() I have no
problem, but when I send a .html file to the fax, it pops up a dialog
box asking me to select a printer.

Try it and see :-)

Any one have any ideas on how to circumvent this pop-dialog box for
..html files?
 
Aha! This is differerent. Yes, I am perfectly aware of this problem - hit it
myself. You see, the html files are associated with IE, which does not
implement correctly printto verb - this means you cannot print html file
without being prompted for a printer. The easiest workaround is to install
Netscape, which handles printto correctly, and make it a default browser. If
this is undesirable, you could be able to keep IE as a default browser but
modify HKEY_CLASSES_ROOT\htmlfile\shell\printto\command contents - make NS
the default browser, save the key content, revert to IE as def browser and
copy the saved key content.

As for me, I ended up writing my own html printing application
 
Back
Top