I want to print some text that will almost surely fit on one page. I thought I could just set up a window without making it visible, and print the content view of the window, with code like this:

        NSView* contentView = (NSView*) [oPrintWindow contentView];
        NSPrintInfo *pi = [NSPrintInfo sharedPrintInfo];
        [pi setVerticallyCentered: NO];
        [pi setHorizontallyCentered: NO];
        [pi setLeftMargin: 72.0f];
        [pi setTopMargin: 72.0f];
        [pi setHorizontalPagination: NSFitPagination];
        [pi setVerticalPagination: NSFitPagination];
        NSPrintOperation *printOp = [NSPrintOperation
                printOperationWithView: contentView
                printInfo: pi];
        [printOp setShowPanels:YES];
        [printOp runOperation];

What happens is that I see the print panel, I click Print or Preview, and then I see a progress window with a progress bar that has gone all the way to the right and a Cancel button. And the progress window just sits there forever. (If I click Cancel, the progress bar changes to a barber pole animating forever.) What am I missing?
--
  James W. Walker, Innoventive Software LLC
  <http://www.frameforge3d.com/>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to