Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Imaging With QuickDraw /
Chapter 9 - Printing Manager / Printing Manager Reference
Printing Manager Routines / Printing a Document


Use the PrOpenDoc function to initialize a printing graphics port for use in printing a document.

FUNCTION PrOpenDoc (hPrint: THPrint; pPrPort: TPPrPort; 
                   pIOBuf: Ptr): TPPrPort;
A handle to a TPrint record (described on page 9-41), which may be a new record or an existing one from a document. You should call the PrintDefault procedure (described on page 9-56) or the PrValidate function (described on page 9-57) for this TPrint record before calling PrOpenDoc.
A pointer to a printing graphics port. If you set this parameter to NIL, PrOpenDoc allocates a new printing graphics port in the heap.
A pointer to an area of memory to be used as an input and output buffer. If you set this parameter to NIL, PrOpenDoc uses the volume buffer for the deferred spool file's volume. If you allocate your own buffer, it must be exactly 522 bytes.
The PrOpenDoc function initializes and returns a pointer to a printing graphics port for use in printing a document. (The TPrPort record that defines a printing graphics port is described on page 9-48.) The PrOpenDoc function also sets the current graphics port to the printing graphics port.

Because both the printing graphics port and input and output buffer are nonrelocatable objects, you may want to allocate them yourself using the pPrPort and pIOBuf parameters (to avoid fragmenting the heap).

You must balance a call to PrOpenDoc with a call to the PrCloseDoc procedure, which is described in the next section.

The trap macro and routine selector for the PrOpenDoc function are
Trap macroSelector

For an example of the use of PrOpenDoc, see Listing 9-2 beginning on page 9-18. For a description of the PrValidate function and PrintDefault procedure, see page 9-57 and page 9-56, respectively.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996