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: Michael Watson <email@hidden>
- Date: Tue, 6 May 2008 18:31:28 -0400
Thoughts:
1. Why not build your own preview panel/window? It's remarkably easy
to do if you already have the image data in an NSData object.
2. If you must use Preview, you could write the image to a temp file
and tell Preview to open that via NSWorkspace's -
openFile:withApplication: method.
--
m-s
On 06 May, 2008, at 18:08, Kimo wrote:
My app produces a list of images (NSData format), and I'd like the
app Preview to display the image when the user double-clicks on an
image in my app.
Currently I use NSPerformService as shown below, which works, but
Preview always asks to save the file when you close its window.
I've seen other apps where you double-click an image and Preview
opens a window with a title something like "Preview of ...." and it
doesn't try to save the image when you close the window.
To send an image to Preview using NSPerformService:
NSData *data; /* assume exists */
NSPasteboard *pb = [NSPasteboard pasteboardWithUniqueName];
[pb declareTypes:[NSArray arrayWithObject:NSTIFFPboardType]
owner:nil];
[pb setData:data forType:NSTIFFPboardType];
NSPerformService( @"Preview/Open images", pb );
It works, but is there a better way to send image data to Preview?
Thanks in advance!
_______________________________________________
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:
@bungie.org
This email sent to email@hidden
_______________________________________________
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