Printing a Fax to a Device Context

This functionality is currently available only in the Microsoft Win32 environment. It is not available in the Component Object Model (COM) implementation environment.

A fax client application does not require a connection to a fax server to print a fax to a printer device context (DC). Instead of calling the FaxSendDocument or FaxSendDocumentForBroadcast functions, an application can provide transmission information directly to the Windows Graphics Device Interface (GDI) functions the Fax Service Client API provides. This enables the client application to transmit an active document by printing it directly to a printer DC. The fax client GDI functions include the FaxStartPrintJob and FaxPrintCoverPage functions.

Since the fax GDI functions use the fax printer driver, you must specify the name of a connected fax printer when you call the FaxStartPrintJob function. The printer can be a local printer, for example, "printername", or a remote printer, such as "\\machinename\printername". If you pass a NULL PrinterName parameter to FaxStartPrintJob, it specifies the local fax printer.

The FaxStartPrintJob function returns a handle to a printer DC. Note that a fax client application should not call the CreateDC Win32 GDI function to create the fax printer DC; nor should it call the StartDoc printing function to start printing a fax document. Instead, the application should call the FaxStartPrintJob function.

To print a fax to a printer device context

  1. Call the FaxStartPrintJob function to retrieve the handle to a fax printer DC. The function returns the handle in a FAX_CONTEXT_INFO structure.
  2. Call the FaxPrintCoverPage function, if a cover page is required, passing a pointer to the FAX_CONTEXT_INFO structure returned by the FaxStartPrintJob function.
  3. Print the fax document to the printer DC in the normal manner, passing the handle to the DC returned by the FaxStartPrintJob function. The procedure can include calls to the StartPage and EndPage Win32 GDI functions.
  4. Call the EndDoc function or the AbortDoc function, passing the handle to the DC returned by FaxStartPrintJob. This closes the document and ends the fax print job.
  5. Call the DeleteDC function to deallocate the handle to the DC.

Printing and Print Spooler Reference