Hello Group. 

I have an NSView-based app (i.e. not document-based), and I’d like to bolt on a 
printing subsystem. I can get NSViews in my main controller to print ok. 
However, I want to have a special view constructed just for printing. The view 
should not show in the app’s window.

I cannot seem to figure out a way to do this.  I have tried various forms of 
these examples:

1. Add an NSView to my main view window? Seems logical, but it’s awkward in a 
storyboard, (I can’t position the view in the storyboard).

2. Programmatically create a custom NSView with a xib?

For this, I’ve tried:

 @IBOutlet weak var printView: NSView!
….
 let printOperation = NSPrintOperation(view: printView!)

This results in the comprehensive "fatal error: unexpectedly found nil while 
unwrapping an Optional value” message.


3. A seperate ViewController? If so, how can I avoid having two print buttons — 
one to call the print controller, and the second, to print the 
PrintController’s view.

I’ve tried reading the Apple docs, but they are not the way I learn best. I’ve 
waded through SE, but have come up blank. Could you point me towards a solution 
please.

Thanks
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to