Strange printing error (?bug)

  • My document based app has one main view which can be resized to a
    custom non-standard size (i.e. not 8 1/2 x 11 or any other standard
    size included in pageLayout).  I want the user to be able to print the
    view on paper with custom sizes that match the view size.  I've set the
    shared printInfo  -paperSize to the custom size of my view, the margins
    are set to zero and I've set it up to use autopagination.  The
    following is my print code snippet and output from my printInfo
    dictionary right before the printOperation is run.  Strangely, the
    preview of the print job is displayed correctly in adobe and
    preview.app (i.e. the margins and size of the page appear correct).
    However, when actually printing the view, the the printer does not
    begin printing at the top of the page but rather, advances several
    inches and then begins printing.  For example, when printing my custom
    view with a rectsize of 6.5 x 3.625 on a standard 8 1/2 x 11 sheet of
    paper, it gets printed at the very bottom of the page!!!  This only
    seems to occur with custom paper sizes and not for standard paper sizes
    such as Number 10 envelopes or 8 1/2 x 11 paper, etc.  Has anyone else
    run into this problem?  Is there something else I should be setting up
    in the specific printer before starting the job? I apologize for the
    long winded post.

    -(void)printShowingPrintPanel:(BOOL)flag
    {
    NSPrintInfo *printInfo = [self printInfo];
    NSPrintOperation *printOp;
    [printInfo setVerticalPagination:NSAutoPagination];
    [printInfo setHorizontalPagination:NSAutoPagination];
    [printInfo setLeftMargin:0];
    [printInfo setTopMargin:0];
    [printInfo setBottomMargin:0];
    [printInfo setRightMargin:0];
    [printInfo setHorizontallyCentered:NO];
    [printInfo setVerticallyCentered:NO];
    NSMutableDictionary *myDict=[NSMutableDictionary
    dictionaryWithDictionary:[[self printInfo] dictionary]];
    NSLog(@"mydict:%@",[myDict description]);

    //start the print operation
    printOp=[NSPrintOperation printOperationWithView:[self view]
    printInfo:printInfo];
    [printOp setShowPanels:flag];
    [self runModalPrintOperation:printOp
                        delegate:nil
                  didRunSelector:NULL
                      contextInfo:NULL];

    }

    mydict:{
        NSBottomMargin = 0;
        NSCopies = 1;
        NSFirstPage = 1;
        NSHorizonalPagination = 0;
        NSHorizontallyCentered = 0;
        NSJobDisposition = NSPrintSpoolJob;
        NSLastPage = 2147483647;
        NSLeftMargin = 0;
        NSMustCollate = 1;
        NSOrientation = 1;
        NSPaperName = "";
        NSPaperSize = <43ea0000 43828000 >;
        NSPrintAllPages = 1;
        NSPrinter = {
        "Device Description" = {NSDeviceIsPrinter = YES; };
        "Language Level" = 0;
        Name = "DESKJET 840C";
        Type = "hp deskjet 840C";
    };
        NSRightMargin = 0;
        NSSavePath = "";
        NSScalingFactor = 1;
        NSTopMargin = 0;
        NSVerticalPagination = 0;
        NSVerticallyCentered = 0;
    }
previous month january 2003 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