# IPrint

The IPrint interface enables OLE objects in general and document objects 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 also control the continuation of printing by calling the IContinueCallback interface. In the future, additional print-related interfaces may be defined that will be available through QueryInterface where IPrint represents merely a base level of support.

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 the “Printable” key.

#### When to Implement

Implementing IPrint is optional. You will usually implement IPrint on whatever object is able to load the persistent state of a given document type; that is, on the same object that also implements either IPersistFile or IPersistStorage for that type.

#### When to Use

Call 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 return 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 | Returns number of pages and number of first page
Print | Prints object’s persistent state