Tomas
Tomas

Reputation: 125

printing to fax on windows without user interaction or pop-ups

I am told that there is a fax modem that operates as a printer, and that I can use that as a standard printer in Windows to accomplish printing to fax destinations. Is that true? If so, what would be the best fax modem to use?

I see that there is a fax device in Windows 7 called Microsoft Shared Fax Driver. Is it possible to print to that, purely in code, without user interaction or popups, to achieve printing to fax?

This is for an application that I work on that can generate reports directly to printer. But we are talking with a client that wants to the reports to go directly to fax. Our application is a reporting library, so there's no user interaction, although there can be configuration to set the fax number, for example. We use J2D+JPS on the Java side, and System.Drawing.Printing on the .NET side. I know that the client could implement this with third party libraries, but I want to address the possibility of simply using our existing direct-to-printer feature.

Upvotes: 0

Views: 592

Answers (1)

Zev Spitz
Zev Spitz

Reputation: 15357

You can use the built-in Fax Service Extended COM API to send a fax programmatically, and without any user interaction.

The API allows you to check if there are any fax devices installed on the machine (via the FaxService.FaxDevices collection) and attach files to a FaxDocument via the Body property.

A caveat: the Body property is actually a string containing the path to the file that should be sent as a fax. From the documentation: the body has to be associated with an application that is installed on that computer, and the application has to support the PrintTo verb. This means that you can't fax the report directly from an in-memory object; you'd have to generate the report to some temporary printable file (an image, a PDF, or XPS) in some location, and set its' path to the Body property of the FaxDocument.

Upvotes: 1

Related Questions