Re: Writing an image from a text view to file
Re: Writing an image from a text view to file
- Subject: Re: Writing an image from a text view to file
- From: Frank Midgley <email@hidden>
- Date: Wed, 10 Mar 2004 14:47:16 -0600
On Mar 10, 2004, at 9:52AM, Jeremy Dronfield wrote:
I have a text view with some text and an image. For my own perverse
reasons, I want to save the text into one file (that's okay, I can
handle that) and the image into a completely separate file, rather
than save the whole lot to rtfd.
I've retrieved the image as an NSTextAttachment. When using rtfd as
the source for the view I can copy the image to file from the
attachment's file inside the rtfd package. But when the view's
contents come from encrypted data (as is more usual in my application)
rather than a file package, [attachment fileWrapper] returns NULL. So
my question is, how can I get the image out of the attachment and into
a file? I know this is a slightly unusual question, but I'd be
grateful for any leads.
Try getting the NSImage with [[[attachment attachmentCell] image] and
then writing that to disk. There are ample examples of saving an
NSImage in the archives.
-Frank
------------------------------------
Frank M. Midgley
email@hidden
http://homepage.mac.com/knarf/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.