printing PDF issues
printing PDF issues
- Subject: printing PDF issues
- From: Victor Bovio <email@hidden>
- Date: Mon, 7 Apr 2008 18:40:50 -0500
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@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