• 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
Re: Still problems resizing my view for printer [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Still problems resizing my view for printer [SOLVED]


  • Subject: Re: Still problems resizing my view for printer [SOLVED]
  • From: Stefan <email@hidden>
  • Date: Sun, 6 Aug 2006 23:19:08 +0200


Great hint! I copied parts of MultiplePageView's code and changed (void)updateFrame
to this:


>>>
- (void)updateFrame {
NSRect rect = NSZeroRect;
rect.size = [printInfo paperSize];
rect.size.height = rect.size.height * numPages;
if (numPages > 1) rect.size.height += (numPages - 1);

if ([self superview]) {
rect.size = [self convertSize:rect.size toView:[self superview]];
}

[self setFrame:rect];
}
<<<


I had to change this method from MultiplePageView, since my view is a 'pure'
view in IB and thus has no surrounding superview. Now, my NSView subclass filles the
complete printer's page and is top-left aligned on the printed page.



Am 06.08.2006 um 18:36 schrieb Todd Ransom:

Stefan,

Have you looked at TextEdit? The rectForPage: method in MultiplePageView seems like it does what you want.

Todd Ransom
Return Self Software
http://returnself.com



On Aug 6, 2006, at 10:09 AM, Stefan wrote:


Am 06.08.2006 um 17:57 schrieb Stefan:

I'll try to rephrase: My NSView subclass prints its content correctly, but does
not get aligned to the top-left corner of the page nor resized to fit the printer's
page size.

I suppose my problem is related to this:

>>>
// Return the drawing rectangle for a particular page number
- (NSRect)rectForPage:(int)page {
NSRect bounds = [self bounds];
float pageHeight = [self calculatePrintHeight];
return NSMakeRect( NSMinX(bounds), NSMaxY(bounds) - page * pageHeight,
NSWidth(bounds), pageHeight );
}
<<<


I never defined 'bounds', since my view is not on-screen.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Still problems resizing my view for printer (From: Stefan <email@hidden>)
 >Re: Still problems resizing my view for printer (From: Stefan <email@hidden>)
 >Re: Still problems resizing my view for printer (From: Shawn Erickson <email@hidden>)
 >Re: Still problems resizing my view for printer (From: Stefan <email@hidden>)
 >Re: Still problems resizing my view for printer (From: Stefan <email@hidden>)
 >Re: Still problems resizing my view for printer (From: Todd Ransom <email@hidden>)

  • Prev by Date: Re: Re: FSCopyObjectASync callback handler
  • Next by Date: Re: FSCopyObjectASync callback handler
  • Previous by thread: Re: Still problems resizing my view for printer
  • Next by thread: Checking if NSButton is key view
  • Index(es):
    • Date
    • Thread