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. I'm not sure what is going on, since the rects seem to be constructed properly. Any ideas? Thanks.

_______________________________________________

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