CFStringRef strings[1];
CFArrayRef ourGraphicsContextsArray;
CGContextRef printingContext;
OSErr err = noErr;
PMPrintSession printSession;
//
// この時点では、プリントセッションはすでに作成されている
//
strings[0] = kPMGraphicsContextCoreGraphics; // これは重要
ourGraphicsContextsArray = CFArrayCreate (kCFAllocatorDefault,
(const void **)strings,
1, &kCFTypeArrayCallBacks);
if (ourGraphicsContextsArray != NULL)
{
err = PMSessionSetDocumentFormatGeneration (printSession,
kPMDocumentFormatPDF,
ourGraphicsContextsArray, NULL);
CFRelease (ourGraphicsContextsArray);
}
//
// 追加のプリントループ
//
//
// 次に、PMSessionBeginDocument と PMSessionBeginPage を呼び出す
//
// プリントコンテキストを要求する準備ができている
err = PMSessionGetGraphicsContext (printSession,
kPMGraphicsContextCoreGraphics, (void **) &printingContext);
//
// Quartz 2D を使用して printingContext にコンテンツを
// レンダリングして、プリントループを続行する
//
|