Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Creating a file containing both an image and text



> You can ask a window's contentView to render itself to an image, which  
> is a lot "friendlier" than overwriting the user's pasteboard with your  
> screenshot.

Thanks for pointing this out.
Indeed we can get a PDF (or EPS) containing the image using 
   NSData * data = [[myWindow contentView] dataWithPDFInsideRect: myRect];
which is cleaner than using the pasteboard.

But the question remains: how can I add text (from an NSString) to this PDF? 
Or alternatively, like in my first attempt, how to include the PDF image into an RTFD file. 

> I haven't used the text system enough to be  
> exactly sure of the details, but I believe you'll have to create a  
> text attachment for the image to go into.

Indeed, for the latter case I found a piece of code (in "Cocoa programming", Anguish, Buck, Yacktman) that uses a text attachment to read an image (tiff) file:

NSTextAttachment * att = [[[NSTextAttachment alloc] initWithFileWrapper: wrapper] autorelease];
NSAttributedString * attStr = [NSAttributedString attributedStringWithAttachment: att];

but I still don't know how to create such an attachment for PDF data in memory.

Any further suggestions?


Thanks for your help,

Arthur C.



_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Creating a file containing both an image and text (From: Arthur C. <email@hidden>)
 >Re: Creating a file containing both an image and text (From: Andrew Farmer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.