• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Creating a file containing both an image and text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Creating a file containing both an image and text
      • From: email@hidden (Stefan Haller)
    • RE: Creating a file containing both an image and text
      • From: Arthur C. <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>)

  • Prev by Date: Re: Where to find artwork for 10.5-only system icons?
  • Next by Date: Re: NSTextView and the Text to Speech system shortcut
  • Previous by thread: Re: Creating a file containing both an image and text
  • Next by thread: RE: Creating a file containing both an image and text
  • Index(es):
    • Date
    • Thread