Contents Index Topic Contents | ||
Previous Topic: IPrint::GetPageInfo Next Topic: IPrint::SetInitialPageNum |
IPrint::Print
HRESULT Print( DWORD grfFlags, DVTARGETDEVICE **pptd, PAGESET **ppPageSet, STGMEDIUM *pstgmOptions, IContinueCallback *pCallback, LONG nFirstPage, LONG *pcPagesPrinted, LONG *pnLastPage );Prints an object on the specified printer, using the specified job requirements.
- Returns one of the following values:
S_OK Success. PRINT_E_CANCELED Printing was canceled before the operation completed. PRINT_E_NOSUCHPAGE A page specified in ppPageSet or nFirstPage does not exist. E_UNEXPECTED The method was called when it was not expected by the object.
- grfFlags
- [in] Bit field specifying print options from the PRINTFLAG enumeration.
- pptd
- [in, out] Address of the target printing device.
- ppPageSet
- [in, out] Address of a PAGESET structure that indicates which pages are to be printed.
- pstgmOptions
- [unique][in, out] Address of object-specific printing options in a serialized OLE property set. Can be NULL on input or return.
- pCallback
- [in] Address of the IContinueCallback interface on the view site, which is to be periodically polled at human-response speeds to determine whether printing should be abandoned. Can be NULL.
- nFirstPage
- [in] Page number of the first page to be printed. This value overrides any value previously passed to the IPrint::SetInitialPageNum method.
- pcPagesPrinted
- [out] Address of the actual number of pages successfully printed.
- pnLastPage
- [out] Address of the page number of the last page printed.
The printer on which the object is to be printed is indicated by the DVTARGETDEVICE structure pointed to by pptd. The DEVMODE structure in the target device indicates whole-job printer-specific options, such as number of copies, paper size, and print quality. The DEVMODE structure can also contain orientation information in the dmOrientation member (this is indicated in the dmFields member). If present, this paper orientation should be used; if absent, natural orientation as determined by the object content is to be used.
Due to the possibility of user input, the parameters pptd and ppPageSet are both [in,out] structures. In the absence of user interaction (that is, if the PRINTFLAG_PROMPTUSER flag is not set), both the target device and the page set will necessarily be the same for input and output. However, if the user is prompted for print options, the object returns target device and page-set information appropriate to what the user has actually chosen.
The pstgmOptions parameter is also [in,out]. On exit, the object should write to pstgmOptions any object-specific information that it would need to reproduce this exact print job. Examples might include whether the user selected "sheet, notes, or both" in a spreadsheet application. The data passed is in the format of a serialized property set. The data is normally useful only when passed back in a subsequent call to the same object. Because a subsequent call might specify different user interaction flags, target device, or other settings, the caller can cause the document to be printed multiple times in the same way in slightly different printing contexts.
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.