Nili
Nili

Reputation: 2003

Cocoa's PDFKit : disable "print to pdf" options

I am using Coco'a PDFKit (Quartz) to show a PDF viewer. Is it possible to enable printing it solely to a printer, and not to a file?

I currently perform:

[self.pdfView printWithInfo:[NSPrintInfo sharedPrintInfo] autoRotate:YES];

(while self.pdfView is of type "PDFView" from Quartz's framework)

What should I do in order to remove the entire "PDF" drop-down menu from the printing menu? PDF drop down menu - how can I remove it?

Upvotes: 1

Views: 636

Answers (2)

Premsagar
Premsagar

Reputation: 21

I know its old thread, but to restrict some options you can set the NSPrintProtected key in printInfo dictionary.

[[printInfo dictionary] setObject:[NSNumber numberWithBool:YES] forKey:@"NSPrintProtected"];

Upvotes: 1

Elwisz
Elwisz

Reputation: 654

In order to suppress the PDF drop down menu you won't probably get around without subclassing NSPrintPanel. NSPrintPanel offers - setAccessoryView method to add functionality, but to my knowledge there is no built-in way to withdraw functionality from it.

Alternatively, you could suppress the whole print panel by calling - setShowsPrintPanel: on your NSPrintOperation object. Of course this has the drawback that the user cannot select the options the print panel would be offering normally.

Upvotes: 0

Related Questions