Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Printing Not Allowed" in OSX app

I am trying to print a simple NSString value. But It gives me a dialog saying:

"Printing Now Allowed

This application is not allowed to print.

Please contact your application vendor for an update."

The code I use is:

-(void)printText:(NSString*)text
{
    NSTextView *printView = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0, 468, 648)];
    [printView setString:text];
    [[NSPrintOperation printOperationWithView:printView] runOperation];
}

Any ideas?

like image 228
Sunkas Avatar asked Sep 16 '13 12:09

Sunkas


2 Answers

Go to Capabilities and to app Sandbox and then find under Hardware the checkmark for "PRINTING"

PRINTING

like image 107
Osman Avatar answered Nov 15 '22 11:11

Osman


Found the answer!

I needed to check "Allow printing" under Entitlements under Summary under my target in project settings.

like image 19
Sunkas Avatar answered Nov 15 '22 13:11

Sunkas