3.2.4.2.1 Printing a Document Using RpcStartDocPrinter
To print a document using RpcStartDocPrinter (section 3.1.4.9.1), the client MUST perform the following steps:
Invoke RpcOpenPrinter (section 3.1.4.2.2), supplying the name of the target printer in the pPrinterName parameter and an AccessRequired Access Value (section 2.2.3.1) that includes PRINTER_ACCESS_USE.
Using the printer handle obtained from RpcOpenPrinter:
Invoke RpcStartDocPrinter to initiate the print job.
For each page in the print job:
Optionally invoke RpcStartPagePrinter to begin the page.
Invoke RpcWritePrinter to send the client's print data to the printer.
Optionally invoke RpcEndPagePrinter to end the page.
Optionally invoke RpcEndDocPrinter to end the print job.
If the client called RpcEndDocPrinter in step 2.3, the client can perform the following:
Repeat step 2 for additional print jobs.
Optionally invoke RpcClosePrinter when finished.
If the client did not call RpcEndDocPrinter in step 2.3, the client MUST invoke RpcClosePrinter, and the server processes the call assuming an implicit call to RpcEndDocPrinter.