我需要知道PDFDocumenta 的PDFView是否已成功列印,以便之后進行一些內務處理。列印常規NSViewfromNSDocument時,我可以
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但是,如果我打電話,列印 a 的內容只能正常作業
[myPDFView printWithInfo:[NSPrintInfo sharedPrintInfo] autoRotate:YES];
因此,我看不到使用關閉列印面板時將呼叫的回呼函式來運行列印操作的方法。
uj5u.com熱心網友回復:
由于 macOS 10.7 有一個PDFDocument回傳 a的函式NSPrintOperation,所以可以簡單地做
NSPrintOperation *op = [myPDFView.document printOperationForPrintInfo:self.printInfo scalingMode:kPDFPrintPageScaleToFit autoRotate:YES];
然后像正常一樣繼續,NSView并在呼叫時添加回呼runModalPrintOperation。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/428598.html
標籤:可可 nsdocument pdf查看
