Problem in print layout near page end
Posted
by Miraaj
on Stack Overflow
See other posts from Stack Overflow
or by Miraaj
Published on 2010-04-13T10:30:25Z
Indexed on
2010/04/13
10:32 UTC
Read the original article
Hit count: 386
Hi all,
I am facing some problem in print layout, below is the description of steps I followed and problem which I am facing:
I have taken a custom view over which there are NSTextViews, NSTableViews arranged one below other.
I am trying to calculate exact height of NSTextViews and NSTableViews depending upon content in them.
Depending upon calculated height I am arranging them in super-custom view.
Then I am printing the view, using this code :
[self arrangeBriefLayoutDynamically];
// step 2nd and 3rd
// setting fixed parameters for printing
NSPrintInfo * printInfo = [NSPrintInfo sharedPrintInfo];
[printInfo setVerticallyCentered:NO];
[printInfo setRightMargin:12.0];
[printInfo setTopMargin:37.0];
[printInfo setLeftMargin:12.0];
[printInfo setHorizontallyCentered:YES];
[printInfo setHorizontalPagination:NSFitPagination];
[printInfo setVerticalPagination:NSAutoPagination];
[printInfo setPaperName:@"na-letter"];
[printInfo setOrientation:NSPortraitOrientation];
PMSetScale([printInfo PMPageFormat], 100.0);
[NSPrintInfo setSharedPrintInfo:printInfo];
[briefCompleteView print:nil];
Problem is : when size of a table view or text view exceeds, such that it crosses the page boundary then SOMETIMES text near boundary appears improper i.e.. part of its height lies on first page and rest of it lies on second page. Click to check problem !
Can anyone suggest me some way to resolve it ?
Thanks,
Miraaj
© Stack Overflow or respective owner