• 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
Print out does not work on Panther
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Validation error in a relationship? (in coredata)
  • Next by Date: Re: TableView not loading completely
  • Previous by thread: Re: Cocoa-dev Digest, Vol 4, Issue 1017
  • Next by thread: What triggs dataRepresentationOfType?
  • Index(es):
    • Date
    • Thread