简体   繁体   English

NSDocument不接收printOperationWithSettings

[英]NSDocument does not receive printOperationWithSettings

I need some help how to debug my NSDocument subclass that do not receive a call to printOperationWithSettings. 我需要一些帮助如何调试我的NSDocument子类没有接收到printOperationWithSettings的调用。

I implement a Document-Subclass 我实现了一个Document-Subclass

class Document: NSDocument {
...

and overwrite the printOperationWithSettings method: 并覆盖printOperationWithSettings方法:

    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. readFromData,dataOfType,makeWindowControllers,...工作正常,但如果我打印,打印首选项面板将打开,打印作业完成其工作,而不要求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 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: 如果使用-printDocument:启动它, 则应调用该方法,而如果调用-print则不会调用该方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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