In my TestDocument (subclass of NSDocument) I added the following code (see 
comments inside, which explain what's happening when I do File → Print...):


- (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)printSettings 
error:(NSError **)outError
{
        NSLog(@"%s printSettings %@, outError %p",__FUNCTION__, printSettings, 
outError);
        //       -[TestDocument printOperationWithSettings:error:] 
printSettings {}, outError 0x7fff5fbfed38 
        
        NSPrintInfo *pi = [ self printInfo ];
        NSLog(@"%s printInfo %@",__FUNCTION__, pi);
        #if 0
                -[TestDocument printOperationWithSettings:error:] printInfo 
                {
                    NSBottomMargin = 90;
                    NSCopies = 1;
                    NSDetailedErrorReporting = 0;
                        [...]
                    NSVerticalPagination = 0;
                    NSVerticallyCentered = 1;
                }
        #endif
        
        NSPrintOperation *op =  [ NSPrintOperation      printOperationWithView: 
textView  printInfo: pi ];
        NSLog(@"%s NSPrintOperation %@ - now run modal",__FUNCTION__, op);
        //      NSPrintOperation <NSConcretePrintOperation: 0x1003b8900> - now 
run modal

        [ self  runModalPrintOperation: op
                delegate:                               nil
                didRunSelector:                 NULL
                contextInfo:                    NULL
        ];

        NSLog(@"%s will return %@",__FUNCTION__, op);   //      ← never comes 
to here
        //      and also no PrintPanel is shown.
        //      if paused, we get this bt:
        #if 0
                #0  0x00007fff8e21e08e in _dispatch_semaphore_wait_slow ()
                #1  0x00007fff8eb8a616 in -[NSDocument 
performActivityWithSynchronousWaiting:usingBlock:] ()
                #2  0x00007fff8eb7a518 in -[NSDocument 
runModalPrintOperation:delegate:didRunSelector:contextInfo:] ()
                #3  0x0000000100001a2d in -[TestDocument 
printOperationWithSettings:error:] (self=0x10013e1e0, _cmd=0x7fff8f081f50, 
printSettings=0x1001161e0, outError=0x7fff5fbfed38) at TestDocument.m:274
        #endif
        
        return op;
}

This code above is taken from some other app, which prints just fine in 
SnowLeopard (but also hangs in Lion).

What am I doing wrong?
Why is there no PrintPanel shown? Why does it just block?

Kind regards,

Gerriet.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to