我需要知道PDFView
的PDFDocument
是否已成功打印,以便在之后进行一些内务处理。从NSDocument
打印常规NSView
时,我可以进行
NSPrintOperation *op = [NSPrintOperation
printOperationWithView:myRegularPrintView
printInfo:self.printInfo];
[op setCanSpawnSeparateThread:NO]; // Because we want to clean up afterwards
[op setShowsPrintPanel:YES];
[self runModalPrintOperation:op
delegate:self
didRunSelector:@selector(documentDidRunModalPrintOperation:success:contextInfo:)
contextInfo:NULL];
在documentDidRunModalPrintOperation
回调中,我可以做内务处理。但是只有当我调用时,打印PDFView
的内容才能正常工作
[myPDFView printWithInfo:[NSPrintInfo sharedPrintInfo] autoRotate:YES];
因此,我认为没有办法使用回调函数来运行打印操作,该函数将在打印面板关闭时调用。
由于macOS 10.7,PDFDocument
中有一个函数返回NSPrintOperation
,因此可以简单地执行
NSPrintOperation *op = [myPDFView.document printOperationForPrintInfo:self.printInfo scalingMode:kPDFPrintPageScaleToFit autoRotate:YES];
然后像正常的CCD_ 9一样继续,并在调用CCD_。