RE: Creating a file containing both an image and text
RE: Creating a file containing both an image and text
- Subject: RE: Creating a file containing both an image and text
- From: Arthur C. <email@hidden>
- Date: Mon, 14 Jan 2008 16:57:28 +0100
- Importance: Normal
> 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:
This email sent to email@hidden