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 (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to