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: Jeremy Dronfield <email@hidden>
- Date: Thu, 11 Mar 2004 21:56:00 +0000
On 10 Mar 2004, at 8:47 pm, Frank Midgley wrote:
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.
It doesn't look as though that will work. [[attachment attachmentCell]
image] provokes a warning, because the NSCell -image method isn't
support in NSTextAttachmentCell's adopted protocols.
- Jeremy
_______________________________________________
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.