NSPrintOperation NSprintInfo printer mac osx swift

1.7k Views Asked by At

I am trying to print tickets on a thermal printer with my Mac. With that I have no problems. I use NSPrintOperation to perform the operation, assisted by NSPrinterInfo to the issue of margins and other settings. The problem is that when I send the order to print the NSView always get the option to choose the printer, number of copies etc ... I'd like to directly print the ticket without going through this intermediate state. Can anyone help me do this?

1

There are 1 best solutions below

2
On

From the documentation, you can choose to set the showsPrintPanel property as follows;

let printOperation = NSPrintOperation(view: someView)
printOperation.showsPrintPanel = false
printOperation.runOperation()