On May 7, 2008, at 9:46 AM, Ken Thomases wrote:

On May 7, 2008, at 10:56 AM, Bill wrote:

I'm embarrassed to say that you're correct. What I remembered was a print preview, and it bypassed the regular print window and Preview button. Instead the image went directly to the preview with the Cancel and Print buttons at the bottom. I just figured out how to do that using NSPrintInfo and its method setShowPanels:NO. Thank you for your help.

Happy to help. I don't have much experience with printing in Cocoa, but -[NSPrintOperation setShowPanels:] is documented as deprecated. I do see -[NSPrintInfo setJobDisposition:] to which you can pass NSPrintPreviewJob. Maybe that will do what you need.

Cheers,
Ken


I have found the following code snippet to do what I want under Leopard:
{
        IBOutlet        NSImageView                     *imageView;
...
        NSPrintInfo* printInfo = [NSPrintInfo sharedPrintInfo];
        [printInfo setJobDisposition:NSPrintPreviewJob];
        [printInfo setHorizontalPagination:NSFitPagination];
        [printInfo setVerticalPagination:NSFitPagination];

        NSSize paperSize = [imageView bounds].size;
        [printInfo setPaperSize:paperSize];

        [printInfo setBottomMargin:1];
        [printInfo setTopMargin:1];
        [printInfo setLeftMargin:1];
        [printInfo setRightMargin:1];

        NSPrintOperation *op = [NSPrintOperation
                        printOperationWithView:imageView
                        printInfo:printInfo];
        [op setShowPanels:NO];
        [op runOperation];
}

Thanks,
-K
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to