简体   繁体   中英

NSDocument does not receive printOperationWithSettings

I need some help how to debug my NSDocument subclass that do not receive a call to printOperationWithSettings.

I implement a Document-Subclass

class Document: NSDocument {
...

and overwrite the printOperationWithSettings method:

    override func printOperationWithSettings(printSettings: [NSObject : AnyObject], error outError: NSErrorPointer) -> NSPrintOperation? {
NSLog(" ******************  printOperationWithSettings")
    return nil
}

But this method is never called. readFromData, dataOfType, makeWindowControllers, ... works ok, but if i print, the printing preference panel will open and the print job does its work without asking printOperationWithSettings.

I did'n know what I am doing wrong, but more frustrating is that I don't know how to debug this. No Idea where to look and how to solve this.

I need to print a special view, - not that one that is currently on the screen, because the user can hide some information that i definitely want to have on paper.

Thanks for any help or idea where i can look and dig on this problem.

ps

how are you starting the print operation? That method should be called if you start it with -printDocument: , while it won't be called if you invoke -print:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM