You do not need to create a view in advance, you can create it when necessary.
If you have a document-based application and a presentation that you want to reset to a printer, then in our MyDocument(or another, what you call it), which expands NSDocument, you should implement:
- (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)ps
error:(NSError **)e
The view then uses the standard drawRect:for drawing.
, PeopleView table , NSDictonary employees:
- (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)ps
error:(NSError **)e
{
PeopleView * view = [[PeopleView alloc] initWithPeople:employees];
NSPrintInfo * printInfo = [self printInfo];
NSPrintOperation * printOp
= [NSPrintOperation printOperationWithView:view
printInfo:printInfo];
[view release];
return printOp;
}
27 "" Hillegass Cocoa Mac OS X.