cpyang@ccnysci.UUCP (Chao Ping Yang) (11/16/88)
I have posted below the segment of MPW C codes to do printing in my program. For small objects, it prints fine, but when the object gets bigger, I get the system error, which sometimes is Resource not found. Can someone tell me if I had done something wrong here? Thanks in advance. ==Chaoping ------------------------------- Cut here --------------------- #include <types.h> #include <stdio.h> #include <quickdraw.h> #include <windows.h> #include <Memory.h> #include <PrintTraps.h> #include <textedit.h> static THPrint myPrRecHdl; static GrafPtr savePort; myInit() /* this is called when the program first starts */ { /* other initializations ... */ PrOpen(); myPrRecHdl = (THPrint) NewHandle(sizeof(TPrint)); PrValidate(myPrRecHdl); /* now it is a valid print record handle */ PrClose(); } /* if str == "Setup", then do page setup, else print the picture */ do_printing(str) char *str; { int error = noErr; TPPrPort myPrPort; TPrStatus myPrStatus; GetPort(&savePort); PrOpen(); /* open printing manager */ if( *str == 'S' ) /* page setup */ PrStlDialog(myPrRecHdl); else if( PrJobDialog(myPrRecHdl) ) { myPrPort = PrOpenDoc(myPrRecHdl,nil,nil); if( (error = PrError()) == noErr ) { PrOpenPage(myPrPort,nil); if( (error=PrError()) == noErr ) { myQuickDrawCalls(); /* the same calls that draw on the screen */ } PrClosePage(myPrPort); } PrCloseDoc(myPrPort); /* release code segments */ /* doing these or not has no effect on the result */ release_main(); release_interface(); release_series(); if( (*myPrRecHdl)->prJob.bJDocLoop == bSpoolLoop && (error = PrError()) == noErr ) { PrPicFile(myPrRecHdl,nil,nil,nil,&myPrStatus); } } PrClose(); SetPort(savePort); return(error); }