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


Summary of the Printing Manager

Pascal Summary

Constants

CONST
   iPrPgFst       = 1;        {page range constant--first page}
   iPrRelease     = 3;        {current version number of the printer driver}
   iPrPgFract     = 120;      {page scale factor}
   iPFMaxPgs      = 128;      {maximum pages in spool file}
   iPrPgMax       = 9999;     {page range constant--last page}

   {PrCtlCall constants for the iWhichCtl parameter}
   iPrBitsCtl     = 4;        {print a bitmap object}
   iPrIOCtl       = 5;        {perform text streaming}
   iPrEvtCtl      = 6;        {print object specified in lParam1 parameter}
   iPrDevCtl      = 7;        {device control command}

   {constants used with iPrBitsCtl (in the lParam1 parameter of PrCtlCall)}
   lScreenBits    = $00000000;   {resolution is 80 x 72 dpi}
   lPaintBits     = $00000001;   {resolution is 72 x 72 dpi}
   lHiScreenBits  = $00000002;   {resolution is 160 x 144 dpi}
   lHiPaintBits   = $00000003;   {resolution is 144 x 144 dpi}

   {constants used with iPrEvtCtl (in the lParam3 parameter of PrCtlCall)}
   lPrEvtAll      = $0002FFFD;   {the entire screen}
   lPrEvtTop      = $0001FFFD;   {the frontmost window}

   {constants used with iPrDevCtl (in the lParam1 parameter of PrCtlCall)}
   lPrReset       = $00010000;   {reserved}
   lPrLineFeed    = $00030000;   {paper advance}
   lPrLFStd       = $0003FFFF;   {carriage return with line feed}
   lPrLFSixth     = $0003FFFF;   {used for low-level call for ImageWriter}
   lPrPageEnd     = $00020000;   {end page}
   lPrDocOpen     = $00010000;   {open document for printing}
   lPrPageOpen    = $00040000;   {open page for printing}
   lPrPageClose   = $00020000;   {close page for printing}
   lPrDocClose    = $00050000;   {close document for printing}

   bDraftLoop     = 0;        {draft-quality printing}
   bSpoolLoop     = 1;        {deferred printing}
   bUser1Loop     = 2;        {reserved}
   bUser2Loop     = 3;        {reserved}

   iPrSavPFil     = -1;       {problem saving print file}
   iPrAbort       = $0080;    {the user pressed Command-period}

   iFMgrCtl    = 8;           {File Mgr's dialog-hook proc's control number}
   pPrGlobals  = $00000944;   {PrVars low memory area}

   iPrDrvrRef     = -3;       {reference number of printer driver}

   {opcodes used with PrGeneral}
   getRslDataOp   = 4;        {get resolutions for the current printer}
   setRslOp       = 5;        {set resolutions for a TPrint record}
   draftBitsOp    = 6;        {force enhanced draft-quality printing}
   noDraftBitsOp  = 7;        {cancel enhanced draft-quality printing}
   getRotnOp      = 8;        {get page orientation of a TPrint record}

   {result codes from PrGeneral}
   noSuchRsl      = 1;        {resolution not supported}

Data Types

TYPE 
   TPPrint = ^TPrint;         {pointer to a TPrint record}
   THPrint = ^TPPrint;        {handle to a TPrint record}
   TPrint =                   {print record}
   RECORD
      iPrVersion: Integer;    {reserved}
      prInfo:     TPrInfo;    {resolution of device & page rectangle}
      rPaper:     Rect;       {paper rectangle}
      prStl:      TPrStl;     {printer driver number & feed type}
      prInfoPT:   TPrInfo;    {reserved}
      prXInfo:    TPrXInfo;   {reserved}
      prJob:      TPrJob;     {information from the job dialog box}
      printX:     ARRAY[1..19] OF Integer;
                              {reserved}
   END;
TPPrInfo = ^TPrInfo;
   TPrInfo =                  {printer information record}
   RECORD
      iDev:    Integer;       {reserved}
      iVRes:   Integer;       {vertical resolution of printer, in dpi}
      iHRes:   Integer;       {horizontal resolution of printer, in dpi}
      rPage:   Rect;          {the page rectangle}
   END;
TPPrJob = ^TPrJob;
   TPrJob =                      {print job record}
   RECORD
      iFstPage:   Integer;       {first page of page range}
      iLstPage:   Integer;       {last page of page range}
      iCopies:    Integer;       {number of copies}
      bJDocLoop:  SignedByte;    {printing method: draft or deferred}
      fFromUsr:   Boolean;       {reserved}
      pIdleProc:  PrIdleProcPtr; {pointer to an idle procedure}
      pFileName:  StringPtr;     {spool filename: NIL for default}
      iFileVol:   Integer;       {spool file volume; set to 0 initially}
      bFileVers:  SignedByte;    {spool file version; set to 0 initially}
      bJobX:      SignedByte;    {reserved}
   END;
TPPrStl = ^TPrStl;
   TPrStl =                   {printing style record}
   RECORD
      wDev:    Integer;       {device number of printer}
      iPageV:  Integer;       {reserved}
      iPageH:  Integer;       {reserved}
      bPort:   SignedByte;    {reserved}
      feed:    TFeed;         {feed type}
   END;
TPPrStatus = ^TPrStatus;
   TPrStatus =                {printing status record}
   RECORD
      iTotPages:  Integer;    {total pages in print file}
      iCurPage:   Integer;    {current page number}
      iTotCopies: Integer;    {total copies requested}
      iCurCopy:   Integer;    {current copy number}
      iTotBands:  Integer;    {reserved}
      iCurBand:   Integer;    {reserved}
      fPgDirty:   Boolean;    {TRUE if current page has been written to}
      fImaging:   Boolean;    {reserved}
      hPrint:     THPrint;    {handle to the active TPrint record}
      pPrPort:    TPPrPort;   {pointer to the active printing graphics port}
      hPic:       PicHandle;  {handle to the active picture}
   END;
TPPrDlg = ^TPrDlg;
   TPrDlg =                            {print dialog box record}
   RECORD
      Dlg:        DialogRecord;        {a dialog record}
      pFltrProc:  ModalFilterProcPtr;  {pointer to event filter}
      pItemProc:  PItemProcPtr;        {pointer to item-handling function}
      hPrintUsr:  THPrint;             {handle to a TPrint record}
      fDoIt:      Boolean;             {TRUE means user clicked OK}
      fDone:      Boolean;             {TRUE means user clicked OK or Cancel}
      lUser1:     LongInt;             {storage for your application}
      lUser2:     LongInt;             {storage for your application}
      lUser3:     LongInt;             {storage for your application}
      lUser4:     LongInt;             {storage for your application}
   END;
TPPrPort = ^TPrPort;
   TPrPort =                  {printing graphics port record}
   RECORD
      gPort:      GrafPort;   {graphics port for printing}
      gProcs:     QDProcs;    {procedures for printing in the graphics port}
      lGParam1:   LongInt;    {reserved}
      lGParam2:   LongInt;    {reserved}
      lGParam3:   LongInt;    {reserved}
      lGParam4:   LongInt;    {reserved}
      fOurPtr:    Boolean;    {reserved}
      fOurBits:   Boolean;    {reserved}
   END;
TFeed = (feedCut,feedFanfold,feedMechCut,feedOther);
TScan = (scanTB,scanBT,scanLR,scanRL);
TPRect = ^Rect; 
PrIdleProcPtr = ProcPtr;
PItemProcPtr = ProcPtr;
PDlgInitProcPtr = ProcPtr;
{records used by PrGeneral}
TGnlData = 
   RECORD
      iOpCode:    Integer; {opcode passed to PrGeneral}
      iError:     Integer; {result code returned by PrGeneral}
      lReserved:  LongInt; {more fields here depending on opcode}
   END;
TGetRslBlk =               {get-resolution record}
   RECORD
      iOpCode:    Integer;    {the getRslDataOp opcode}
      iError:     Integer;    {result code returned by PrGeneral}
      lReserved:  LongInt;    {reserved}
      iRgType:    Integer;    {printer driver version number}
      xRslRg:     TRslRg;     {x-direction resolution range}
      yRslRg:     TRslRg;     {y-direction resolution range}
      iRslRecCnt: Integer;    {number of resolution records}
      rgRslRec:   ARRAY[1..27] OF TRslRec;
                              {array of resolution records}
   END;
TRslRg = 
   RECORD
      iMin:    Integer; {minimum resolution supported}
      iMax:    Integer; {maximum resolution supported}
   END;
TRslRec = 
   RECORD
      iXRsl:   Integer; {discrete resolution, x direction}
      iYRsl:   Integer; {discrete resolution, y direction}
   END;
TSetRslBlk =               {set-resolution record}
   RECORD
      iOpCode:    Integer;    {the setRslOp opcode}
      iError:     Integer;    {result code returned by PrGeneral}
      lReserved:  LongInt;    {reserved}
      hPrint:     THPrint;    {handle to the current TPrint record}
      iXRsl:      Integer;    {x-direction resolution you want}
      iYRsl:      Integer;    {y-direction resolution you want}
   END;
TDftBitsBlk =              {draft bits record}
   RECORD
      iOpCode:    Integer;    {draftBitsOp or noDraftBitsOp opcode}
      iError:     Integer;    {result code returned by PrGeneral}
      lReserved:  LongInt;    {reserved}
      hPrint:     THPrint;    {handle to the current TPrint record}
   END;
TGetRotnBlk =              {page orientation record}
   RECORD
      iOpCode:    Integer;    {the getRotnOp opcode}
      iError:     Integer;    {result code returned by PrGeneral}
      lReserved:  LongInt;    {reserved}
      hPrint:     THPrint;    {handle to current TPrint record}
      fLandscape: Boolean;    {TRUE if user selected landscape printing}
      bXtra:      SignedByte; {reserved}
   END;

Printing Manager Routines

Opening and Closing the Printing Manager

PROCEDURE PrOpen;
PROCEDURE PrClose;

Initializing and Validating TPrint Records

PROCEDURE PrintDefault      (hPrint: THPrint);
FUNCTION PrValidate         (hPrint: THPrint): Boolean;

Displaying and Customizing the Print Dialog Boxes

FUNCTION PrStlDialog        (hPrint: THPrint): Boolean;
FUNCTION PrJobDialog        (hPrint: THPrint): Boolean;
FUNCTION PrDlgMain          (hPrint: THPrint; pDlgInit: PDlgInitProcPtr):
Boolean;
FUNCTION PrStlInit          (hPrint: THPrint): TPPrDlg;
FUNCTION PrJobInit          (hPrint: THPrint): TPPrDlg;
PROCEDURE PrJobMerge        (hPrintSrc: THPrint; hPrintDst: THPrint);

Printing a Document

FUNCTION PrOpenDoc          (hPrint: THPrint; pPrPort: TPPrPort; 
                             pIOBuf: Ptr): TPPrPort;
PROCEDURE PrCloseDoc        (pPrPort: TPPrPort);
PROCEDURE PrOpenPage        (pPrPort: TPPrPort; pPageFrame: TPRect);
PROCEDURE PrClosePage       (pPrPort: TPPrPort);
PROCEDURE PrPicFile         (hPrint: THPrint; pPrPort: TPPrPort; 
                             pIOBuf: Ptr; pDevBuf: Ptr; 
                             VAR prStatus: TPrStatus);

Optimizing Printing

PROCEDURE PrGeneral         (pData: Ptr);

Handling Printing Errors

FUNCTION PrError            : Integer;
PROCEDURE PrSetError        (iErr: Integer);

Low-Level Routines

FUNCTION PrDrvrVers         : Integer;
PROCEDURE PrDrvrOpen;
PROCEDURE PrDrvrClose;
FUNCTION PrDrvrDCE: Handle;
PROCEDURE PrCtlCall         (iWhichCtl: Integer; lParam1: LongInt;
                             lParam2: LongInt; lParam3: LongInt);

Application-Defined Routines

PROCEDURE MyDoPrintIdle;
FUNCTION MyPrDialogAppend   (hPrint: THPrint): TPPrDlg;

C Summary

Constants

enum {
   iPrPgFst    = 1,     /* page range constant--first page */
   iPrRelease  = 3,     /* current version number of the printer driver */
   iPrPgFract  = 120,   /* page scale factor */
   iPFMaxPgs   = 128,   /* maximum pages in spool file */
   iPrPgMax    = 9999,  /* page range constant--last page */

   /* PrCtlCall constants for the iWhichCtl parameter */
   iPrBitsCtl     = 4,  /* print a bitmap object */
   iPrIOCtl       = 5,  /* perform text streaming */
   iPrEvtCtl      = 6,  /* print object specified in lParam1 parameter */
   iPrDevCtl      = 7,  /* device control command */

   /* constants used with iPrBitsCtl (in the lParam1 parameter 
      of PrCtlCall) */
   lScreenBits    = 0,           /* resolution is 80 x 72 dpi */
   lPaintBits     = 1,           /* resolution is 72 x 72 dpi */
   lHiScreenBits  = 0x00000002,  /* resolution is 160 x 144 dpi */
   lHiPaintBits   = 0x00000003,  /* resolution is 144 x 144 dpi */

   /* constants used with iPrEvtCtl (in the lParam3 parameter 
      of PrCtlCall) */
   lPrEvtAll      = 0x0002FFFD,  /* the entire screen */
   lPrEvtTop      = 0x0001FFFD,  /* the frontmost window */
/* constants used with iPrDevCtl (in the lParam1 parameter 
      of PrCtlCall) */
   lPrReset       = 0x00010000,  /* reserved */
   lPrLineFeed    = 0x00030000,  /* paper advance */
   lPrLFStd       = 0x0003FFFF,  /* carriage return with line feed */
   lPrLFSixth     = 0x0003FFFF,  /* used for low-level call for 
                                    ImageWriter */
   lPrPageEnd     = 0x00020000,  /* end page */
   lPrDocOpen     = 0x00010000,  /* open document for printing */
   lPrPageOpen    = 0x00040000,  /* open page for printing */
   lPrPageClose   = 0x00020000,  /* close page for printing */
   lPrDocClose    = 0x00050000,  /* close document for printing */
bDraftLoop     = 0,           /* draft-quality printing */
   bSpoolLoop     = 1,           /* deferred printing */
   bUser1Loop     = 2,           /* reserved */
   bUser2Loop     = 3,           /* reserved */
iPrSavPFil     = -1,          /* problem saving print file */
   iPrAbort       = 0x0080,      /* the user pressed Command-period */

   iFMgrCtl       = 8,           /* File Mgr's dialog-hook proc's control 
                                    number */
   pPrGlobals     = 0x00000944,     /* PrVars low memory area */

   iPrDrvrRef     = -3, /* reference number of printer driver */

   /* opcodes used with PrGeneral */
   getRslDataOp   = 4,  /* get resolutions for the current printer */
   setRslOp       = 5,  /* set resolutions for a TPrint record */
   draftBitsOp    = 6,  /* force enhanced draft-quality printing */
   noDraftBitsOp  = 7,  /* cancel enhanced draft-quality printing */
   getRotnOp      = 8,  /* get page orientation of a TPrint record */

   /* result code from PrGeneral */
   noSuchRsl      = 1,  /* resolution not supported */
};

Data Types

struct TPrint {         /* print record */
   short    iPrVersion; /* reserved */
   TPrInfo  prInfo;     /* resolution of device & page rectangle */
   Rect     rPaper;     /* paper rectangle */
   TPrStl   prStl;      /* printer driver number & feed type */
   TPrInfo  prInfoPT;   /* reserved */
   TPrXInfo prXInfo;    /* reserved */
   TPrJob   prJob;      /* information from the job dialog box */ 
   short    printX[19]; /* reserved */
};
typedef struct TPrint TPrint;
typedef TPrint *TPPrint, **THPrint;
struct TPrInfo {        /* printer information record */
   short    iDev;       /* reserved */
   short    iVRes;      /* vertical resolution of printer, in dpi */
   short    iHRes;      /* horizontal resolution of printer, in dpi */
   Rect     rPage;      /* the page rectangle */
};
typedef struct TPrInfo TPrInfo;
typedef TPrInfo *TPPrInfo;
struct TPrJob {         /* print job record */
   short    iFstPage;   /* first page of page range */
   short    iLstPage;   /* last page of page range */
   short    iCopies;    /* number of copies */
   char     bJDocLoop;  /* printing method: draft or deferred */
   Boolean  fFromUsr;   /* reserved */
   PrIdleProcPtr
            pIdleProc;  /* pointer to an idle procedure */
   StringPtr
            pFileName;  /* spool filename: NIL for default */
   short    iFileVol;   /* spool file volume; set to 0 initially */
   char     bFileVers;  /* spool file version; set to 0 initially */
   char     bJobX;      /* reserved */
};
typedef struct TPrJob TPrJob;
typedef TPrJob *TPPrJob;
struct TPrStl {      /* printing style record */
   short    wDev;    /* device number of printer */
   short    iPageV;  /* reserved */
   short    iPageH;  /* reserved */
   char     bPort;   /* reserved */
   TFeed    feed;    /* feed type */
};
typedef struct TPrStl TPrStl;
typedef TPrStl *TPPrStl;
struct TPrStatus {         /* printing status record */
   short       iTotPages;  /* total pages in print file */
   short       iCurPage;   /* current page number */
   short       iTotCopies; /* total copies requested */
   short       iCurCopy;   /* current copy number */
   short       iTotBands;  /* reserved */
   short       iCurBand;   /* reserved */
   Boolean     fPgDirty;   /* TRUE if current page has been written to */
   Boolean     fImaging;   /* reserved */
   THPrint     hPrint;     /* handle to the active TPrint record */
   TPPrPort    pPrPort;    /* pointer to the active printing graphics port */
   PicHandle   hPic;       /* handle to the active picture */
};
typedef struct TPrStatus TPrStatus;
typedef TPrStatus *TPPrStatus;
struct TPrDlg {               /* print dialog box record */
   DialogRecord   Dlg;        /* a dialog record */
   ModalFilterProcPtr
                  pFltrProc;  /* pointer to event filter */
   PItemProcPtr   pItemProc;  /* pointer to item-handling function */
   THPrint        hPrintUsr;  /* handle to a TPrint record */
   Boolean        fDoIt;      /* TRUE means user clicked OK */
   Boolean        fDone;      /* TRUE means user clicked OK or Cancel */
   long           lUser1;     /* storage for your application */
   long           lUser2;     /* storage for your application */
   long           lUser3;     /* storage for your application */
   long           lUser4;     /* storage for your application */
};
typedef struct TPrDlg TPrDlg;
typedef TPrDlg *TPPrDlg;
typedef pascal TPPrDlg (*PDlgInitProcPtr)(THPrint hPrint);
truct TPrPort {         /* printing graphics port record */
   GrafPort gPort;      /* graphics port for printing */
   QDProcs  gProcs;     /* procedures for printing in the graphics port */
   long     lGParam1;   /* reserved */
   long     lGParam2;   /* reserved */
   long     lGParam3;   /* reserved */
   long     lGParam4;   /* reserved */
   Boolean  fOurPtr;    /* reserved */
   Boolean  fOurBits;   /* reserved */
};
typedef struct TPrPort TPrPort;
typedef TPrPort *TPPrPort;
enum {feedCut,feedFanfold,feedMechCut,feedOther};
typedef unsigned char TFeed;
enum {scanTB,scanBT,scanLR,scanRL};
typedef unsigned char TScan;
typedef Rect *TPRect;
typedef pascal void (*PrIdleProcPtr)(void);
typedef pascal void (*PItemProcPtr)(DialogPtr theDialog, short item);
/* structures used by PrGeneral */
struct TGnlData {
   short iOpCode;    /* opcode passed to PrGeneral */
   short iError;     /* result code returned by PrGeneral */
   long  lReserved;  /* more fields here depending on call */
};
typedef struct TGnlData TGnlData;
struct TGetRslBlk {        /* get-resolution record */
   short    iOpCode;       /* the getRslDataOp opcode */
   short    iError;        /* result code returned by PrGeneral */
   long     lReserved;     /* reserved */
   short    iRgType;       /* printer driver version number */
   TRslRg   xRslRg;        /* x-direction resolution range */
   TRslRg   yRslRg;        /* y-direction resolution range */
   short    iRslRecCnt;    /* number of resolution records */
   TRslRec  rgRslRec[27];  /* array of resolution records */
};
typedef struct TGetRslBlk TGetRslBlk;
struct TRslRg {   
   short    iMin;          /* minimum resolution supported */
   short    iMax;          /* maximum resolution supported */
};
typedef struct TRslRg TRslRg;
struct TRslRec {  
   short    iXRsl;         /* discrete resolution, x direction */
   short    iYRsl;         /* discrete resolution, y direction */
};
typedef struct TRslRec TRslRec;
struct TSetRslBlk {        /* set-resolution record */
   short    iOpCode;       /* the setRslOp opcode */
   short    iError;        /* result code returned by PrGeneral */
   long     lReserved;     /* reserved */
   THPrint  hPrint;        /* handle to the current TPrint record */
   short    iXRsl;         /* x-direction resolution you want */
   short    iYRsl;         /* y-direction resolution you want */
};
typedef struct TSetRslBlk TSetRslBlk;
struct TDftBitsBlk {       /* draft bits record */
   short    iOpCode;       /* draftBitsOp or noDraftBitsOp opcode */
   short    iError;        /* result code returned by PrGeneral */
   long     lReserved;     /* reserved */
   THPrint  hPrint;        /* handle to the current TPrint record */
};
typedef struct TDftBitsBlk TDftBitsBlk;
struct TGetRotnBlk {       /* page orientation record */
   short    iOpCode;       /* the getRotnOp opcode */
   short    iError;        /* result code returned by PrGeneral */
   long     lReserved;     /* reserved */
   THPrint  hPrint;        /* handle to current TPrint record */
   Boolean  fLandscape;    /* TRUE if user selected landscape printing */
   char     bXtra;         /* reserved */
};
typedef struct TGetRotnBlk TGetRotnBlk;

Printing Manager Functions

Opening and Closing the Printing Manager

pascal void PrOpen              (void); 
pascal void PrClose             (void); 

Initializing and Validating TPrint Records

pascal void PrintDefault        (THPrint hPrint); 
pascal Boolean PrValidate       (THPrint hPrint); 

Displaying and Customizing the Print Dialog Boxes

pascal Boolean PrStlDialog      (THPrint hPrint); 
pascal Boolean PrJobDialog      (THPrint hPrint); 
pascal Boolean PrDlgMain        (THPrint hPrint, PDlgInitProcPtr pDlgInit); 
pascal TPPrDlg PrStlInit        (THPrint hPrint); 
pascal TPPrDlg PrJobInit        (THPrint hPrint); 
pascal void PrJobMerge          (THPrint hPrintSrc, THPrint hPrintDst); 

Printing a Document

pascal TPPrPort PrOpenDoc       (THPrint hPrint, TPPrPort pPrPort, Ptr pIOBuf); 
pascal void PrCloseDoc          (TPPrPort pPrPort); 
pascal void PrOpenPage          (TPPrPort pPrPort, TPRect pPageFrame); 
pascal void PrClosePage         (TPPrPort pPrPort); 
pascal void PrPicFile           (THPrint hPrint, TPPrPort pPrPort, Ptr pIOBuf,
                                 Ptr pDevBuf, TPrStatus *prStatus); 

Optimizing Printing

pascal void PrGeneral           (Ptr pData); 

Handling Printing Errors

pascal short PrError            (void); 
pascal void PrSetError          (short iErr);

Low-Level Functions

pascal short PrDrvrVers         (void);
pascal void PrDrvrOpen          (void); 
pascal void PrDrvrClose         (void); 
pascal Handle PrDrvrDCE         (void); 
pascal void PrCtlCall           (short iWhichCtl, long lParam1,
                                 long lParam2, long lParam3); 

Application-Defined Functions

pascal void MyDoPrintIdle       (void);
pascal TPPrDlg MyPrDialogAppend
                                (THPrint hPrint);

Assembly-Language Summary

Data Structures

TPrint Data Structure
0iPrVersionwordprinter driver version that initialized this record
2prInfo14 bytesTPrInfo data structure with resolution of device and page rectangle
16rPaper8 bytespaper rectangle
24prStl8 bytesTPrStl data structure with printer driver number and feed type
32prInfoPT14 bytesTPrInfo data structure; reserved
46prXInfo16 bytesTPrXInfo data structure; reserved
62prJob20 bytesTPrJob data structure with printing information from the job dialog box
82printX40 bytesreserved

TPrInfo Data Structure
0iDev6 bytesfirst word is reserved; second word contains vertical resolution of printer, in dpi; third word contains horizontal resolution of printer, in dpi
6rPage8 bytesthe page rectangle

TPrJob Data Structure
0iFstPagewordfirst page of page range
2iLstPagewordlast page of page range
4iCopieswordnumber of copies
6bJDocLoop1 byteprinting method: draft or deferred
7fFromApp1 bytereserved
8pIdleProclongpointer to an idle procedure
12pFileNamelongspool filename: NIL for default
16iFileVolwordspool file volume: set to 0 initially
18bFileVers1 bytespool file version: set to 0 initially

TPrStl Data Structure
0wDevworddevice number of the current printer (in the high-order byte of this field); the low-order byte of this field is reserved
2iPageVwordreserved
4iPageHwordreserved
7feed1 bytepaper feed type

TPrStatus Data Structure
0iTotPageswordtotal pages in print file
2iCurPagewordcurrent page number
4iTotCopieswordtotal copies requested
6iCurCopywordcurrent copy number
8iTotBandswordreserved
10iCurBandwordreserved
12fPgDirty1 byteTRUE if current page has been written to
13fImaging1 bytereserved
14hPrintlonghandle to the active TPrint data structure
18pPrPortlongpointer to the active printing graphics port
22hPiclonghandle to the active picture

TPrDlg Data Structure
0dlg168 bytesa dialog record
168pFltrProclongpointer to event filter
172pItemProclongpointer to item-handling function
176hPrintUsrlonghandle to TPrint data structure
180fDoIt1 byteTRUE means user clicked OK
181fDone1 byteTRUE means user clicked OK or Cancel
182lUser1longstorage for your application
186lUser2longstorage for your application
190lUser3longstorage for your application
194lUser4longstorage for your application

TPrPort Data Structure
0gPort178 bytesgraphics port and procedures for printing

Trap Macros

Trap Macros Requiring Routine Selectors

_PrGlue
SelectorRoutine
$C8000000PrOpen
$D0000000PrClose
$20040480PrintDefault
$52040498PrValidate
$2A040484PrStlDialog
$32040488PrJobDialog
$4A040894PrDlgMain
$3C04040CPrStlInit
$44040410PrJobInit
$5804089CPrJobMerge
$04000C00PrOpenDoc
$08000484PrCloseDoc
$10000808PrOpenPage
$1800040CPrClosePage
$60051480PrPicFile
$BA000000PrError
$C0000200PrSetError
$70070480PrGeneral
$94000000PrDrvrDCE
$9A000000PrDrvrVers
$80000000PrDrvrOpen
$88000000PrDrvrClose
$A0000E00PrCtlCall

Global Variable
PrintErrPrinting error.

Result Codes
iPrAbort128Application or user requested cancel
opNotImpl2Requested PrGeneral opcode not implemented in the current printer driver
noSuchRsl1Resolution requested with the PrGeneral procedure is not supported
noErr0No error
iPrSavPFil-1Problem saving print file
controlErr-17Unimplemented control instructions; the Device Manager returns this result code
iIOAbort-27I/O error
iMemFullErr-108There is not enough room in the heap zone
resNotFound-192The current printer driver does not support PrGeneral; you should clear this error with a call to PrSetError with a parameter value of 0; otherwise, PrError might still contain this error next time you check it
PAPNoCCBs-4096There are no free connect control blocks (CCBs) available
PAPBadRefnum-4097Bad connection reference number
PAPActive-4098The request is already active
PAPTooBig-4099The write request is too big
PAPConnClosed-4100The connection is closed
PAPNoPrinter-4101The printer is not found, is closed, or is not selected
 -8131Printer not responding
manualFeedTOErr-8132A timeout occurred (that is, no communication has occurred with the printer for two minutes); this is usually caused by an extremely long imaging time or a dropped connection
generalPSErr-8133A PostScript error occurred during transmission of data to the printer; this is most often caused by a bug in the application-supplied PostScript code
zoomRangeErr-8160The print image enlarged by the user with the Page Setup dialog box overflows the available page resolution
errBadFontKeyType-8976Font found in printer is not Type 1, TrueType, or bitmapped font
errPSStateUnderflow-8977PostScript stack underflow while restoring graphics state
errNoPattern-8978The pixel pattern could not be found and could not be built
errBadConverterID-8979The 'PDEF' converter doesn't exist
errNoPagesSpooled-8980Application called PrOpenDoc and PrCloseDoc without calling PrOpenPage and PrClosePage in between
errNullColorInfo-8981The getColor function called with null GetColorInfo handle
errPSFileNameNull-8982The filename pointer for the spool file is null
errSpoolFolderIsAFile-8983The spool folder is a file instead of a folder
errBadConverterIndex-8984When saving a spool file to disk, the value fileTypeIndex field had no matching entry in the driver
errDidNotDownloadFont-8985A PostScript outline could not be found for a PostScript font, and there is no associated 'sfnt' resource
errBitmapFontMissing-8986Unable to build bitmap for font
errPSFileName-8987PostScript file isn't named
errCouldNotMakeNumberedFilename-8989Could not make a unique filename for the spool file
errBadSpoolFileVersion-8990Bad version number in header of spool file
errNoProcSetRes-8991The resource describing needed procedure sets is unavailable for the PostScript prolog
errInLineTimeout-8993The printer is not responding
errUnknownPSLevel-8994The PostScript level has an unknown value
errFontNotFound-8995Font query reply didn't match any fonts in list of PostScript names
errSizeListBad-8996The size list contained an entry that could not be reconciled with the typeface list
errFaceListBad-8997Entry could not be found in typeface list
errNotAKey-8998Key for desired font number and style could not be found in font table


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996