As you speak of COM-interface, I assume that you do not want NET functions but winAPI ones.
Here is a first glance view of referenced page:
EnumPrinters
allows to get the list of printers - unsure whether you need it...
OpenPrinter
give you a handle to a specific printer
BOOL OpenPrinter(
LPTSTR pPrinterName, // printer or server name
LPHANDLE phPrinter, // printer or server handle
LPPRINTER_DEFAULTS pDefault // printer defaults
);
GetPrinter
gives you many information on a printer, and specifically the PRINTER_INFO_9
structure specifying the per-user default printer settings.
BOOL GetPrinter(
HANDLE hPrinter, // handle to printer
DWORD Level, // information level (9 to get the PRINTER_INFO_9)
LPBYTE pPrinter, // printer information buffer
DWORD cbBuf, // size of buffer
LPDWORD pcbNeeded // bytes received or required
);
typedef struct _PRINTER_INFO_9 {
LPDEVMODE pDevMode; // contains actual setting like orientation...
} PRINTER_INFO_9, *PPRINTER_INFO_9;
SetPrinter
allows to set configuration back to printer
BOOL SetPrinter(
HANDLE hPrinter, // handle to printer object
DWORD Level, // information level (9 to use the PRINTER_INFO_9)
LPBYTE pPrinter, // printer data buffer
DWORD Command // printer-state command
);
You can then use the StartDoc
, EndDoc
calls to do actual printing enclosing each page with StartPage
EndPage
, optionnaly regestering an AbortProc
procedure. Alternatively, you I think that you can use the configured printer through IWebBrowser2
interface but I never used that part.
I know that this is still far for a real example of configuring a printer and using it, but at least it should give enough hints and pointers.