Automatically open PDF in Preview when printing

289 Views Asked by At

I'm setting jobDisposition to NSPrintPreviewJob in NSPrintInfo, but the value seems to be ignored. Instead of opening the document in Preview, the print operation displays the print panel as usual.

1

There are 1 best solutions below

0
On BEST ANSWER

To go directly to preview, you need to suppress the print panel:

printInfo.jobDisposition = NSPrintPreviewJob;
NSPrintOperation *op = [NSPrintOperation printOperationWithView:view
                                                      printInfo:printInfo];
op.showsPrintPanel = NO;
[op runOperation];