• 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: Copying an image file to pasteboard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copying an image file to pasteboard


  • Subject: Re: Copying an image file to pasteboard
  • From: j o a r <email@hidden>
  • Date: Mon, 2 Aug 2004 22:23:56 +0200

I have a working implementation that looks something like this:

- (void) copy:(id) sender
{
NSPasteboard *pboard = [NSPasteboard generalPasteboard];

[pboard declareTypes: [NSMutableArray arrayWithObject:
NSTIFFPboardType] owner: nil];

[pboard setData: [myImage TIFFRepresentation] forType:
NSTIFFPboardType];
}

j o a r

On 2004-08-02, at 21.56, Jeremy Dronfield wrote:

> This question is so basic I can't even believe I'm having to ask it;
> but I can't find anything in the docs or archives, so here goes.
>
> In the Finder, select an image file and hit Command-C to copy it, then
> open TextEdit and hit Command-V. The image is pasted in. Saving and
> opening the RTFD package, you will find that the image attachment
> inside has the title of the original image. Fine. So how was that
> image written to the pasteboard by the Finder? I have an application
> in which I want to be able to place images on the pasteboard for
> pasting into other apps. However, the only way I can get a pastable
> image onto the pasteboard is by doing [pboard setData:[image
> TIFFRepresentation] forType:NSTIFFPboardType]. This is clearly not the
> same thing. I've tried:
>
> [pboard setPropertyList:[NSArray arrayWithObject:filePath]
> forType:NSFilenamesPboardType]
>
> and
>
> [pboard writeFileContents:filePath]
>
> and creating a file wrapper from the file and using,
>
> [pboard writeFileWrapper:wrapper]
>
> and various combinations of these. None of them work. Can someone
> please tell me what I'm missing here?

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.


References: 
 >Copying an image file to pasteboard (From: Jeremy Dronfield <email@hidden>)

  • Prev by Date: Copying an image file to pasteboard
  • Next by Date: Re: NSTask for interactive telnet
  • Previous by thread: Copying an image file to pasteboard
  • Next by thread: Re: Copying an image file to pasteboard
  • Index(es):
    • Date
    • Thread