Hi,

I have a document-based Cocoa application, in which I display quartz routines directly to the context of my NSView. Following the documentation I added this methods to enable printing in my application:


on NSDocument:

- (void)printDocumentWithSettings:(NSDictionary *)printSettings showPrintPanel:(BOOL)showPrintPanel delegate:(id)delegate didPrintSelector: (SEL)didPrintSelector contextInfo:(void *)contextInfo
{
    NSView *view = [self myDocumentView];
    NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
NSPrintOperation *printOp = [NSPrintOperation printOperationWithView:view printInfo:printInfo];
    [printOp setShowPanels:showPrintPanel];
    [self runModalPrintOperation:printOp delegate:delegate
didRunSelector:didPrintSelector contextInfo:contextInfo];
}


on NSView:

- (void)drawRect:(NSRect)rect
{
    NSGraphicsContext *nsctx = [NSGraphicsContext currentContext];
    CGContextRef context = (CGContextRef)[nsctx graphicsPort];
    // draw quartz routines to the context
}

- (BOOL)knowsPageRange:(NSRangePointer)aRange
{
    aRange->location = 1;
    aRange->length = 1;
    return YES;
}

- (NSRect)rectForPage:(NSInteger)pageNumber
{
    return NSMakeRect(0, 0, 8.5*72, 11*72);
}


It works and I can print, but I have two problems:

1) the preview image that is displayed in the print panel does not show correctly the contents of my view, it looks like it was blured (a lot)

2) if I select a different page size and/or orientation in the page setup panel, it is ignored when I print.


Any ideas what I'm missing ??

Thanks.


_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [EMAIL PROTECTED]

Reply via email to