• 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: Printing a View
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing a View


  • Subject: Re: Printing a View
  • From: Matt Neuburg <email@hidden>
  • Date: Sun, 12 Jul 2009 12:17:20 -0700
  • Thread-topic: Printing a View

On Sun, 12 Jul 2009 11:02:31 -0700, "K. Darcy Otto" <email@hidden> said:
>I'm trying to print a custom view.  I've already customized that view
>in -drawRect:, and everything seems to be displayed correctly.  The
>problem I'm having is that when it comes time to do -rectForPage, the
>output to the printer seems to shift around.  Here is the code:
>
>-(NSRect)rectForPage:(NSInteger)pageNumber
>{
> // Note the current page
> currentPage = pageNumber-1;
>
> float pHeight = 500.0;
>
> NSLog(@"Begin page %d at: %f",pageNumber,pHeight * currentPage);
> NSRect returnRect = NSMakeRect(0, pHeight * currentPage,
>pageRect.size.width, pHeight);
> NSLog(@"End page %d at %f: %f",pageNumber,pHeight * currentPage +
>pHeight);
>
> return returnRect;
>}
>
>Now, I set pHeight 500.0 just in an attempt to diagnose this problem.
>The output from the log looks like this:
>
>2009-07-12 11:00:57.981 Deductions[5031:10b] Begin page 1 at: 0.000000
>2009-07-12 11:00:58.002 Deductions[5031:10b] End page 1 at 500.000000:
>0.000000
>2009-07-12 11:00:58.395 Deductions[5031:10b] Begin page 2 at: 500.000000
>2009-07-12 11:00:58.406 Deductions[5031:10b] End page 2 at
>1000.000000: 0.000000
>2009-07-12 11:00:58.645 Deductions[5031:10b] Begin page 3 at:
>1000.000000
>2009-07-12 11:00:58.655 Deductions[5031:10b] End page 3 at
>1500.000000: 0.000000
>2009-07-12 11:00:58.673 Deductions[5031:10b] Begin page 4 at:
>1500.000000
>2009-07-12 11:00:58.687 Deductions[5031:10b] End page 4 at
>2000.000000: 0.000000
>
>So, this is just as expected.  The problem is that the output to the
>printer makes it seem like page 2, for example, starts not where page
>1 ended, but rather several lines down from where page 1 ended.

Several lines down? Could that be the extra 500 you keep introducing?
Really, since what you need to say in rectForPage depends completely on how
you draw in drawRect, which you don't show, it's hard to guess from here
what rectForPage *should* be (or whether you even need to implement it)...
m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



_______________________________________________

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: Printing a View
      • From: "K. Darcy Otto" <email@hidden>
  • Prev by Date: Core Data fetch exception: keypath <transient attribute> not found in entity
  • Next by Date: Re: Core Data fetch exception... further
  • Previous by thread: Printing a View
  • Next by thread: Re: Printing a View
  • Index(es):
    • Date
    • Thread