objective-cmacosprintingnsprintoperation

Is it possible to override NSPrintOperation settings after the panel was shown?


When you call [NSPrintOperation runOperation], the printing system runs the print options panel, and when the user clicks OK, the printing occurs.

Is there a way to modify some of the user's chosen settings (in the NSPrintInfo object) after the panel has run, but before the actual printing occurs? I want to override a few of the settings.

I know you can suppress the panel altogether, but I'm interested in a way to "intercept" the print settings instead.


Solution

  • Actually, it was easy - I'm not sure why I had so many problems with it first.

    You can access all print job options in [NSPrintOperation printInfo], and the child printSettings dictionary. The options are sometimes a bit hidden, but they're all there (copies, duplex, which tray to use etc.). Even the model-specific settings (like controlling a Xerox printer's stapler unit).

    It helps to examine the different values when you're manually launching jobs with different options chosen.