Print out does not work on Panther
Print out does not work on Panther
- Subject: Print out does not work on Panther
- From: Peter <email@hidden>
- Date: Tue, 16 Oct 2007 21:11:37 -0400
I have a problem of printing report on Panther. The text is crop when
preview in PDF or print to laser printer. However there is no problem
with output to PDF or printer on Tiger. The page size is correct on
both Panther and Tiger. The width and height of custom view is 100 and
200 in the nib file.
What can be the problem ? Is the custom view too small ? I can't
stretch the view size since the window size is small. I tried setFrame,
both Panther and Tiger pint out was cropped.
Is it possible not to make custom view on nib ? Since it is only for
printing, no display of any text or graphics.
Below is a test code to show this problem,
#import "PrnView.h"
// A4 paper size
#define PAGE_WIDTH 541.0f
#define PAGE_HEIGHT 895.0f
@implementation PrnView
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
return self;
}
- (BOOL)knowsPageRange:(NSRangePointer)aRange
{
aRange->location=aRange->length=1;
return YES;
}
- (NSRect)rectForPage:(int)page
{
return NSMakeRect(0.0,0.0, PAGE_WIDTH, PAGE_HEIGHT);
}
- (void)drawRect:(NSRect)rect
{
NSAttributedString *drawStr;
NSDictionary *txtDict;
NSFont *font;
NSSize siz;
NSRect rt;
int cnt;
if ([[NSGraphicsContext currentContext] isDrawingToScreen])
return;
// [self setFrame:NSMakeRect(0.0,0.0, PAGE_WIDTH, PAGE_HEIGHT)];
font = [NSFont fontWithName:@"Helvetica" size:7.0f];
if (font == nil)
font = [NSFont systemFontOfSize:7.0f];
txtDict = [NSDictionary dictionaryWithObjectsAndKeys:font,
NSFontAttributeName,
[NSColor blackColor], NSForegroundColorAttributeName, nil];
drawStr = [[NSAttributedString alloc] initWithString:@"This is a test
!" attributes:txtDict];
siz = [drawStr size];
rt.origin.x =
rt.origin.y = 10.0f;
rt.size = siz;
for (cnt=0; cnt<80; cnt++) {
[drawStr drawInRect:rt];
rt.origin.y += siz.height + 2.0f;
}
[drawStr release];
}
@end
Thanks in advance for any advice or ideas.
Peter
________________________________________________________________________
Check Out the new free AIM(R) Mail -- Unlimited storage and
industry-leading spam and email virus protection.
_______________________________________________
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