0

I use below code for print view1 and when i run it, a window open and i should select settings and click on print button then the view will print.how to do it (settings) in code (means window doesn't open and directly print view1 with settings that we set in code)

NSPrintOperation *printOperation= [NSPrintOperation 

printOperationWithView:view1];
[printOperation runOperation];

1 Answers1

0

You can suppress the display of the NSPrintPanel object by sending setShowsPrintPanel: with a NO argument to the NSPrintOperation object before running the operation.

Just like this:

NSPrintOperation *printOperation= [NSPrintOperation printOperationWithView:view1];

[printOperation setShowsPrintPanel:NO];
[printOperation runOperation];
Justin Boo
  • 10,132
  • 8
  • 50
  • 71
  • And, for the other part, you can configure the settings by instantiating `NSPrintInfo`, set its properties, and pass it to `-[NSPrintOperation setPrintInfo:]`. – Ken Thomases May 20 '12 at 20:23