Re: Printing an NSDocument
Re: Printing an NSDocument
- Subject: Re: Printing an NSDocument
- From: Dave Robertson <email@hidden>
- Date: Thu, 7 May 2009 17:21:22 +1200
For the record, the unusual NSPrinting errors I encountered are the
result of passing a nil reference as the first parameter to
+ (NSPrintOperation *)printOperationWithView:(NSView *)aView printInfo:
(NSPrintInfo *)aPrintInfo
Hope this helps someone else in the future.
Regards,
Dave.
On 5/05/2009, at 3:24 PM, Dave Robertson wrote:
Hi,
I'm trying to print a customView which is part of an NSDocument.
As soon as the print panel appears I get the following slew of
errors:
-[NSView(NSPrinting)
beginPrologueBBox:creationDate:createdBy:fonts:forWhom:pages:title:]
was deprecated before Mac OS 10.0 and overrides of it are not being
invoked anymore, starting in Mac OS 10.5.
2009-05-05 00:56:58.594 Untitled3[362:10b] -[NSView(NSPrinting)
endHeaderComments] was deprecated before Mac OS 10.0 and overrides
of it are not being invoked anymore, starting in Mac OS 10.5.
2009-05-05 00:56:58.594 Untitled3[362:10b] -[NSView(NSPrinting)
endPrologue] was deprecated before Mac OS 10.0 and overrides of it
are not being invoked anymore, starting in Mac OS 10.5.
2009-05-05 00:56:58.595 Untitled3[362:10b] -[NSView(NSPrinting)
beginSetup] was deprecated before Mac OS 10.0 and overrides of it
are not being invoked anymore, starting in Mac OS 10.5.
2009-05-05 00:56:58.595 Untitled3[362:10b] -[NSView(NSPrinting)
endSetup] was deprecated before Mac OS 10.0 and overrides of it are
not being invoked anymore, starting in Mac OS 10.5.
2009-05-05 00:56:58.596 Untitled3[362:10b] -[NSView(NSPrinting)
beginPage:label:bBox:fonts:] was deprecated before Mac OS 10.0 and
overrides of it are not being invoked anymore, starting in Mac OS
10.5.
2009-05-05 00:56:58.596 Untitled3[362:10b] -[NSView(NSPrinting)
beginPageSetupRect:placement:] was deprecated before Mac OS 10.0 and
overrides of it are not being invoked anymore, starting in Mac OS
10.5.
2009-05-05 00:56:58.597 Untitled3[362:10b] -[NSView(NSPrinting)
addToPageSetup] was deprecated before Mac OS 10.0 and overrides of
it are not being invoked anymore, starting in Mac OS 10.5.
2009-05-05 00:56:58.597 Untitled3[362:10b] -[NSView(NSPrinting)
endPageSetup] was deprecated before Mac OS 10.0 and overrides of it
are not being invoked anymore, starting in Mac OS 10.5.
2009-05-05 00:56:58.598 Untitled3[362:10b] -[NSView(NSPrinting)
beginTrailer] was deprecated before Mac OS 10.0 and overrides of it
are not being invoked anymore, starting in Mac OS 10.5.
2009-05-05 00:56:58.598 Untitled3[362:10b] -[NSView(NSPrinting)
endTrailer] was deprecated before Mac OS 10.0 and overrides of it
are not being invoked anymore, starting in Mac OS 10.5.
...and the print operation fails.
I'm using 10.5.6 with all software up to date and Xcode 3.0
Apple docs give conflicting advice: "Printing Programming Topics for
Cocoa" says to use printShowingPrintPanel:showPanels, but the API
refs say that this is deprecated.
Here's the method I'm using in my NSDocument subclass:
- (void)printDocument:(id)sender {
NSPrintInfo* printInfo;
printInfo = [self printInfo];
NSPrintOperation *op = [NSPrintOperation printOperationWithView:
theView printInfo:printInfo ];
[op runOperationModalForWindow:[[[self windowControllers]
objectAtIndex:0] window]
delegate:self
didRunSelector:@selector(printOperationDidRun:success:contextInfo:)
contextInfo:NULL];
}
I initially though that my project was at fault, but creating a new
minimal NSDocument architecture project shows the same symptoms.
Has anyone else seen these errors, and does anyone have suggestions
as to what may be happening?
Thanks,
Dave Robertson
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden