Objects that implement the IPrintable interface can participate in printing and print preview. The IPrintable interface is shown in Example 86 below.
class __declspec(uuid("9B35CA0F-7A12-401e-8BD5-4330074FF35B")) IPrintable { public: /* Get number of pages in document. */ virtual int GetPageCount(CPrintDoc* pPrintDoc) = 0; /* Prepare the next page for printing. */ virtual bool BeginPage(CPrintDoc* pPrintDoc) = 0; /* Print the current page to the print document. */ virtual bool PrintPage(CPrintDoc* pPrintDoc) = 0; /* Cleanup after printing a page. */ virtual bool EndPage(CPrintDoc* pPrintDoc) = 0; }; |
Printable objects are expected to output one page at time to a document object. They implement the BeginPage(), PrintPage(), and EndPage() functions in order to print a single page. The BeginPage() and EndPage() functions provide the printable object with an opportunity to separate the process of printing a page into three steps. The document object passed into these functions provides a device context on which to render the pages. Printable objects must also provide a count of the total number of printed pages in a given job by implementing the GetPageCount() function. A printable object can implement GetPageCount() either by returning the number of pages it contains or by returning –1 to indicate that the printing should continue until PrintPage() returns false. Printable objects do not drive the printing process – they simply respond to requests for pages of printed output.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.