PtrDevice Class

<< Click to Display Table of Contents >>

Navigation:  RpPrinter & PtrDevice Class Overview >

PtrDevice Class

Previous pageReturn to chapter overviewNext page

Purpose

The purpose of this class is to provide access to the Windows printer facilities in an enhanced fashion.

Properties

AllPages

BottomMargin

CollateCopies

Color

Copies

CurrentPageNumber

DefaultPaperSource

DeviceContext

DeviceModeFields

DisablePrint2File

Duplex

ExportObject

FromPage

HidePrint2File

HPixelsPerInch

InPreview

InPrint

IsValid

Landscape

LeftMargin

LogPaperLength

LogPaperWidth

LogPixelsPerInchX

LogPixelsPerInchY

LogPrintAreaLength

LogPrintAreaWidth

MaxPage

Access/Assign

Access/Assign

Access/Assign

Access/Assign

Access/Assign

Access

Access/Assign

Access

Access

Assign

Access/Assign

Access

Access/Assign

Assign

Access

Access

Access

Access

Access/Assign

Access/Assign

Access

Access

Access/Assign

Access/Assign

Access

Access

Assign

 

MinPage

NoPageNums

NoSelection

PageNums

PaperLength

PaperLengthInches

PaperSize

PaperWidth

PaperWidthInches

Print2File

PrintDlgFlags

PrinterDeviceContext

PrinterDriver

PrinterName

PrinterPort

PrintQuality

PrintWindow

PromptForFile

PromptForPrintDlg

Quit

RightMargin

Selection

ToPage

TopMargin

VPixelsPerInch

XPrinterRes

YPrinterRes

Assign

Assign

Assign

Access/Assign

Access/Assign

Access

Access/Assign

Access/Assign

Access

Access/Assign

Access/Assign

Access

Access

Access

Access

Access/Assign

Access

Access/Assign

Access/Assign

Access

Access/Assign

Access/Assign

Access/Assign

Access/Assign

Access

Access/Assign

Access/Assign

Methods

CreatePrinterDC

CreatePrinterIC

GetPaperBins

GetPaperSizes

GetPrinters

Init

Print

PrintExport

PrintPreview

QuitPreview SetPrinterByName

SetPrinterByPort

SetPrinterToDefault

ShowExportDlg

ShowPrintDlg

ShowSetupDlg

Callback Methods

The following methods are automatically called by the PtrDevice object during printing if they exist as methods of the Report object.  The Report object is the object which is specified in the second parameter of the PtrDevice:Init().

 

PrintEnd

PrintPageBody

PrintPageFooter

PrintPageHeader

 PrintPostBody

PrintPreBody

PrintSetPage

PrintStart

 

Description

The PtrDevice class gives you access to the Windows printer system and guides the production of your output in an event driven manor.  To use the PtrDevice class, you must instantiate a PtrDevice object, perform desired initialization and call the Print() or PrintPreview() method.

 

Once you call the Print() or PrintPreview() method, the PtrDevice gathers output for the report by calling the callback methods identified above.  The callback methods are invoked only if they exist as part of the Report object (the object passed as the second parameter of the PtrDevice instantiation).  The methods (if they exist) are called in the following order:

 

// called once to allow for initialization

         PrintStart()                                

         

// called before PreBody

PrintSetPage()                                

         

// called once (useful for title page,

// table of contents, etc.)

PrintPreBody()                                

                                                                         

 

                         // loop for each page

                         // each of the below methods are called

// once for each page

                         PrintSetPage()                                

                         PrintPageHeader()

                         PrintPageBody()

                         PrintPageFooter()

 

                         // Loop ends when PRINT_NOMORE or

// PRINT_ERROR is returned

                         // from PrintPageBody()

 

// called once (useful for

// report totals, footnotes etc.)                

PrintPostBody()                                

         

// called once to allow for clean up.

PrintEnd()                                                

 

Example

The PTR_EX sample program is a good example of PtrDevice class usage.  Even though the samples use the RpPrinter class, they illustrate the proper use of the callback methods.