IPrint

The IPrint interface enables compound documents in general and active documents in particular to support programmatic printing. Once a document is loaded, containers and other clients can call IPrint::Print to instruct a document to print itself, specifying printing control flags, the target device, the particular pages to print, and other options. The client can control the continuation of printing by calling the IContinueCallback interface.

An object that implements IPrint registers itself with the Printable key stored under its CLSID as follows:

HKEY_CLASSES_ROOT\CLSID\{...}\Printable
 

Callers determine whether a particular object class supports programmatic printing of its persistent state by looking in the registry for this key.

When to Implement

Implementing IPrint is optional. You usually implement IPrint on a view object. .

When to Use

Call the methods of IPrint when you want an object to print its current state. Using this interface, a caller can tell the object to print itself, set the initial page number of the printed document, and obtain both the number of pages and the number of the first page to be printed.

Methods in VTable Order

IUnknown Methods Description
QueryInterface Returns pointers to supported interfaces
AddRef Increments reference count
Release Decrements reference count

IPrint Methods Description
SetInitialPageNum Sets number of first page
GetPageInfo Obtains number of pages and number of first page
Print Prints object's persistent state

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in docobj.h.