Re: attributed strings and embedded images.
Re: attributed strings and embedded images.
- Subject: Re: attributed strings and embedded images.
- From: email@hidden
- Date: Mon, 15 Apr 2002 16:11:25 -0700
On Monday, April 15, 2002, at 03:07 PM, Douglas Davidson wrote:
On Monday, April 15, 2002, at 02:24 PM, email@hidden wrote:
I am trying to manipulate an attributed string from an NSTextView.
When I drag/drop or cut/paste an image into it say from Internet
Explorer... the pasteboard type is PICT... but when I send the
attributed string as email, (using the Message framework), it ends up
being an UNcompressed TIFF.
I was hoping someone had some advice for me as to how to maybe
manipulate the attributed string to make the images into JPG's or
something that a cross platform mail reader would understand and might
take less space.
The text system currently converts incoming pasted images into attached
TIFF data in most cases. This behavior may change; it is possible that
in the future it will pay more attention to the type of data coming
in. You can manipulate this programmatically by changing the
NSFileWrapper associated to a given NSTextAttachment.
I have iterated through the textStorage and see the attachment, but all
I get is the name 'Name "pastedGraphic.tiff"'...
- (void)logAttachments:(NSAttributedString *)s
{
NSRange fullRange = NSMakeRange(0, [s length]);
while (fullRange.length > 0) {
NSRange effectiveRange;
id attr = [s attributesAtIndex:fullRange.location
longestEffectiveRange:&effectiveRange inRange:fullRange];
fullRange = NSMakeRange(NSMaxRange(effectiveRange),
NSMaxRange(fullRange) - NSMaxRange(effectiveRange));
NSLog(@"attr = %@", attr);
}
}
output: attr = {NSAttachment = Name "pastedGraphic.tiff"; }
How do I get a handle on the NSTextAttachment object behind it?
_______________________________________________
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.