Re: Sending an image to Preview to preview the image
Re: Sending an image to Preview to preview the image
- Subject: Re: Sending an image to Preview to preview the image
- From: Bill <email@hidden>
- Date: Wed, 7 May 2008 09:55:23 -0700
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 (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