从Mac App提供打印选项 [英] Provide print option from mac app

查看:104
本文介绍了从Mac App提供打印选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Mac应用。在Mac应用程序中,我的屏幕上有一个 scrollView ,其中包含一个文本字段。在同一屏幕上,我有一个需要提供打印选项的按钮。可以打印文本字段的文本。 打印按钮应调用Mac OS X的打印对话框。我可以通过xib将按钮连接到第一响应者的打印选项上,从而打开打印对话框,但是当我预览时,除了打印按钮外,看不到任何文本。请帮忙。

I have a Mac app. In my Mac app one of my screen has a scrollView which contains a text field. On the same screen I have a button that needs to provide a print option. The text of the text field can be printed. Print button should call the Mac OS X print dialog box. I am able to open the print dialog box by connecting the button to the print option of the first responder through xib but when I preview I don't see any text except the print button. Please help.

推荐答案

请查阅《 NSPrintOperation类参考》。
NSPrintOperation类参考

check out the NSPrintOperation Class Reference. NSPrintOperation Class Reference

您可能需要将文本撰写到一个足以容纳滚动视图内容的NSView中……我从来没有从scrollView进行打印,所以我不知道。

you will probably need to compose the text to a NSView that is large enough to fit your scroll view contents... I haven't ever had to print from a scrollView, so i don't know.

看看

+ printOperationWithView:

您可能必须覆盖print:操作,请记住您将把它发送给第一响应者...并且应该属于您的NSDocument或NSApplication子类,但是如果没有基于文档的文档,如果没有基于Windows的NSWindow(子类或委托),我可能会尝试在NSDocument上获取它。

you will probably have to override the print: action, remember that you will be sending that to the first responder... and should fall through to your NSDocument or NSApplication subclass, but I would probably try to grab it at NSDocument if document based, NSWindow (subclass or delegate) if not.

这篇关于从Mac App提供打印选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆