CPrintJob Class

class CPrintJob

The CPrintJob class encapsulates the task of sending a document to a printer. It takes a printable object, IPrintable, and a document, CPrintDoc, and coordinates the printing to the document.

Defined in: PrintJob.h

See Also

CPrinter

CPrintConfig

CPrintPreviewFrameImpl

Class Members

CPrintJob(CPrinterConfig* pPrinterConfig = NULL) : (CPrinterConfig* pPrinterConfig = NULL)

Constructs the print job.

CPrinter m_printer

The printer object.

int m_nJobId

Print job ID obtained from the document.

virtual bool Start(IPrintable* pIPrintable, CPrintDoc* pPrintDoc)

To begin the print process, invoke the Start method passing in a pointer to the current printable object and a CPrintDoc instance initialized with the printer configuration.

virtual bool Cancel()

Cancels/deletes the print job.

virtual bool Delete()

Deletes the print job.

virtual bool Pause()

Pauses the print job.

virtual bool Restart()

Restarts an in-progress print job.

virtual bool Resume()

Resumes a paused print job.

DWORD GetStatus()

Returns the status of the print job. For status values, please refer to the Win32 documentation on the JOB_INFO_1 structure.

virtual bool SetPriority(DWORD dwPriority)

Sets the job priority. For valid priority values, please refer to the Win32 documentation on the JOB_INFO_1 structure.

bool OpenPrinter(CPrinterConfig* pPrinterConfig)

Opens the printer identified by the CPrinterConfig parameter.

bool ClosePrinter()

Closes the printer associated with the print job.