CPrintDoc Class
class CPrintDoc
The CPrintDoc class encapsulates the Windows DOCINFO structure, printer configuration data, printer device context and exposes an interface for rendering output to a printer or file. CPrintDoc provides the necessary support for print preview by maintaining two device context - a printer device context and an output device context. The printer dc always refers to a device context that represents the printer. The output dc, however, will represent the display screen during a print preview operation and the printer dc while printing.During a printing operation, CPrintDoc's public accessors can be used to retrieve information such as the current page number, document info and printer configuration data.
Defined in: PrintDoc.h
See Also
Class Members
DOCINFO m_docInfo
Win32 structure containing the input and output file names and other printing related information.
HDC m_dcPrint
Handle to the printer device context.
HDC m_dcOutput
Handle to the output device context. In preview mode, this refers to the screen DC.
int m_nCurPage
The current page number.
CPrinterConfig* m_pPrinterConfig
Printer configuration information.
LPCTSTR GetDocumentName() const
Retrieves the document name from the DOCINFO structure.
void SetDocumentName(LPCTSTR lpszDocName)
Sets the document name in the DOCINFO structure.
LPCTSTR GetOutputFileName() const
Returns the output file name.
void SetOutputFileName(LPCTSTR lpszOutput)
Sets the output file name.
LPCTSTR GetDataType() const
Returns the data type specified for the print job.
void SetDataType(LPCTSTR lpszDatatype)
Sets the data type to be used for the print job.
DWORD GetType() const
Returns any additional information specified about the print job.
void SetType(const DWORD fwType)
Sets additional information about the print job.
void SetOutputDC(const HDC hDC)
Sets the output device context.
virtual CPrinterConfig* GetPrinterConfig()
Returns a pointer to the printer configuration data that CPrintDoc maintains.
void SetPrinterConfig(CPrinterConfig* pPrinterConfig)
Sets the printer configuration data for the document.
HDC GetOutputDC() const
Returns the output device context.
void SetPrintDC(const HDC hDC)
Sets the device context handle used for printing.
HDC GetPrintDC() const
Returns the printer device context.
virtual int StartDoc()
Starts the print job by invoking the Win32 ::StartDoc() API.
virtual int EndDoc()
Signals termination of the print job.
virtual int AbortDoc()
Stops the current print job.
int GetCurPage() const
Retrieves the current page number.
void SetCurPage(const int nCurPage)
Sets the current page number.
int IncrementPage()
Increments the current page number.