<div class="content"><p>RpcStartDocPrinter notifies the <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_59fb3ddc-63cf-45df-8a90-46a6af9e00cb" data-linktype="relative-path">print server</a> that a
document is being spooled for printing.</p><dl>
<dd>
<div><pre> DWORD RpcStartDocPrinter(
   [in] PRINTER_HANDLE hPrinter,
   [in] DOC_INFO_CONTAINER* pDocInfoContainer,
   [out] DWORD* pJobId
 );
</pre></div>
</dd></dl><p><b>hPrinter: </b>A handle to a printer object or <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_ac027425-6043-4ad3-be27-56a381b75d38" data-linktype="relative-path">port</a> object that was opened
by <a href="bd0bb8d5-26fd-4705-81f5-614d32b9f38f" data-linktype="relative-path">RpcAddPrinter (section 3.1.4.2.3)</a>,
<a href="3af45717-308f-4b4f-8428-430d12856110" data-linktype="relative-path">RpcAddPrinterEx (section 3.1.4.2.15)</a>,
<a href="989357e2-446e-4872-bb38-1dce21e1313f" data-linktype="relative-path">RpcOpenPrinter (section 3.1.4.2.2)</a>,
or <a href="0e81ce18-72b1-46c3-8584-a205393b04ff" data-linktype="relative-path">RpcOpenPrinterEx (section 3.1.4.2.14)</a>.
The printer handle MUST NOT be in use for printing another document at the time
of this call.</p><p><b>pDocInfoContainer: </b>A parameter specified in <a href="35a96c73-9f4f-4280-ae57-8e4f72834929" data-linktype="relative-path">DOC_INFO_CONTAINER
Parameters (section 3.1.4.1.8.2)</a>.</p><p><b>pJobId: </b>A pointer to a variable that receives
a nonzero <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_12a6e569-e97c-4761-92f0-e397f8d5125f" data-linktype="relative-path">print job</a>
identifier. The job MUST be created with an identifier that is unique for this
printer.</p><p><b>Return Values: </b>This method MUST return zero
(ERROR_SUCCESS) to indicate successful completion or a nonzero Windows error
code to indicate failure <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.</p><p>Upon receiving this message, the server MUST validate the
following:</p><ul><li><p><span><span> 
</span></span>Perform the validation steps that are specified in <a href="10bfa8c2-d456-4ad0-912d-e674766a36c8" data-linktype="relative-path">PRINTER_HANDLE
Parameters (section 3.1.4.1.11)</a>. This method SHOULD assume that
the handle to the printer or port object can be used without further access
checks.</p>
</li><li><p><span><span> 
</span></span>Perform the validation steps that are specified in
DOC_INFO_CONTAINER Parameters.</p>
</li><li><p><span><span> 
</span></span>The server MUST verify that RpcStartDocPrinter does not get
called twice for a given printer or port object without an intervening call to <a href="209fcf32-05b4-44ab-a3a4-779cfae181ca" data-linktype="relative-path">RpcEndDocPrinter (section 3.1.4.9.7)</a>.
If that verification fails, return ERROR_INVALID_HANDLE.</p>
</li></ul><p>If parameter validation fails, the server MUST fail the
operation immediately and return a nonzero error response to the client.
Otherwise, the server MUST process the message and compose a response to the
client as follows:</p><ul><li><p><span><span> 
</span></span>Create the job object and associate it with a job queue.</p>
<ul><li><p><span><span>  </span></span>If <i>hPrinter</i>
is a printer object handle, associate the job with the job queue of that
printer object.</p>
</li><li><p><span><span>  </span></span>If <i>hPrinter</i>
is a port object handle, select an arbitrary printer object associated with
that port object and associate the job with the job queue of that printer
object.</p>
</li></ul></li><li><p><span><span> 
</span></span>Associate a data type with the print job.</p>
<ul><li><p><span><span>  </span></span>If
the <b>pDatatype</b> member of the <a href="20f7b510-e6a0-4f6c-97a0-5630d1e70879" data-linktype="relative-path">DOC_INFO_1</a> structure that
is pointed to by the <b>pDocInfo1</b> pointer in the <a href="c4f39f63-3017-45bf-8b8a-81ab9458f052" data-linktype="relative-path">DOC_INFO_CONTAINER</a> and
pointed to by <i>pDocInfoContainer</i> is non-NULL, then use the data type
specified in <b>pDatatype</b> as the data type for the print job.</p>
</li><li><p><span><span>  </span></span>If
the <b>pDatatype</b> member of the DOC_INFO_1 structure is NULL, <i>hPrinter</i>
is a printer object handle, and the data type contained in the context for <i>hPrinter</i>
is non-NULL, then use the data type specified by the context for <i>hPrinter</i>
for the print job.</p>
</li><li><p><span><span>  </span></span>If
the <b>pDatatype</b> member of the DOC_INFO_1 structure is NULL and the context
for <i>hPrinter</i> does not contain a data type, then use the printer&#39;s
default data type for the print job.</p>
</li></ul></li><li><p><span><span> 
</span></span>Write the ID of the created job in the variable that is pointed
to by the <i>pJobId</i> parameter.</p>
</li><li><p><span><span> 
</span></span>If any clients that have registered for notification of the job
object creation, a notification MUST be broadcast to them.</p>
</li><li><p><span><span> 
</span></span>Return the status of the operation.</p>
</li></ul></div>