Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!cmcl2!rocky8!cucard!ccnysci!cpyang From: cpyang@ccnysci.UUCP (Chao Ping Yang) Newsgroups: comp.sys.mac.programmer Subject: Help! How to Print?? Summary: Print Manager Keywords: Print Manager MPW C Message-ID: <990@ccnysci.UUCP> Date: 15 Nov 88 20:42:41 GMT References: <63398@ti-csl.CSNET> <1479@murdu.OZ> Reply-To: cpyang@ccnysci.UUCP (Chao Ping Yang) Organization: City College of New York Lines: 80 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 #include #include #include #include #include #include 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); }