Print out does not work on Panther

  • 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.
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today