//-----------------------------------------------------------------------------------------------------------------------
void ProcessPrintCommand(DocStoragePtr docStP, UInt32 commandID)
{
    OSStatus err = noErr;
    PMPrintSession  printSession = NULL;
    
    if ( PMCreateSession(&printSession) == noErr )
    {
	if (commandID == kHICommandPageSetup)
	{
	    DoPageSetupDialog(printSession, &docStP->pageFormat, &docStP->flattenedPageFormat);
	}
	else if (commandID == kHICommandPrint)
	{
	    if (docStP->pageFormat == NULL)
	    {
		err = MyCreatePageFormat(printSession, &docStP->pageFormat);
	    }

	    if (DoPrintDialog(printSession, docStP->pageFormat, &docStP->printSettings) == noErr)
	    {
		DoPrintLoop(docStP, printSession, docStP->pageFormat, docStP->printSettings);
	    }
	}
	PMRelease(printSession);
    }
    else
    {
	fprintf(stderr, "PMCreateSession FAILED\n");
    }
}   // ProcessPrintCommand
Exemple #2
0
int ioPrint(PrintingLogicPtr printJob) {  
    OSStatus		status = noErr;

    if (printJob->thePrRecHdl == NULL) 
        return -1;
        
    //	Execute the print loop.
    if (status == noErr)
        status = DoPrintLoop(printJob);
 
    if(status == kPMCancel)
        status = noErr;
        
    return status;
}