Hillegass printing challenge
Hillegass printing challenge
- Subject: Hillegass printing challenge
- From: Michael de Haan <email@hidden>
- Date: Thu, 18 Feb 2010 11:06:54 -0800
Hi all,
May I ask about an issue I am having adding page numbers to a print out.
I implemented the following method:
- (void)drawPageBorderWithSize:(NSSize)borderSize
{
// NSPrintOperation *po = [NSPrintOperation currentOperation];
//NSPrintInfo *pi = [po printInfo];
NSRect currentFrame = [self frame];
NSRect newFrame= NSMakeRect(0, 0, borderSize.width, borderSize.height);
[self setFrame:newFrame];
NSFont *f = [attributes objectForKey:NSFontAttributeName];
float capHeigth = [ f capHeight];
NSString *string = [ NSString stringWithFormat:@"Page %d", currentPage + 1];
float stringX = (borderSize.width - (float)[string length])/2.0;
[self lockFocus];
[string drawAtPoint:NSMakePoint(stringX, borderSize.height - (1.7 * capHeigth))
withAttributes:attributes];
[self unlockFocus];
[self setFrame:currentFrame];
}
A while ago, there were questions to the list about printInfo "margin" calls. At that time, it appears the consensus was that these calls are buggy. I think they still are, as my code showed that the margins returned bore no relationship to the margins set in page Setup. As a workaround, I used the above approach. What do others do to deduce the user's margin settings....or it's possible that I am missing something else.
Thanks in advance._______________________________________________
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