• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Hillegass printing challenge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Hillegass printing challenge
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: How do I get keyboard events in an NSStatusWindowLevel window while my application is not frontmost?
  • Next by Date: Re: How do I get keyboard events in an NSStatusWindowLevel window while my application is not frontmost?
  • Previous by thread: Re: How do I get keyboard events in an NSStatusWindowLevel window while my application is not frontmost?
  • Next by thread: Re: Hillegass printing challenge
  • Index(es):
    • Date
    • Thread