macoscocoaprintingnsprintoperation

Can I set _every_ custom printing option with Cocoa's NSPrintInfo and NSPrintOperation?


I'm trying to find out if I can print on Mac OS X without showing the system print panel and still programmatically set every print option, even the ones of third party printer drivers.

I want to use NSPrintInfo.

Is this possible? Do all Mac printer drivers have to "go through" the printing system, meaning that every Mac printer driver has to make every option that they display in their driver's UI accessible programmatically through NSPrintInfo?

Or can third parter printer driver venders have settings that are impossible to set through NSPrintInfo?

Thanks!


Solution

  • This should be possible, every setting is stored in the PMPrintSettings object, and you can manipulate this as an NSMutableDictionary using:

    https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPrintInfo_Class/Reference/Reference.html#//apple_ref/occ/instm/NSPrintInfo/printSettings

    You can examine any NSPrintInfo and see the keys and values. Of course, for the third-party drivers, these are almost never documented, but all the settings are in there for you to mess with.