Mac Quick Look Preview in an NSView or NSImage?

Posted by Niko Matsakis on Stack Overflow See other posts from Stack Overflow or by Niko Matsakis
Published on 2010-01-30T21:45:16Z Indexed on 2010/04/05 3:03 UTC
Read the original article Hit count: 815

Filed under:
|
|

I am looking for a way (public or otherwise) to get an NSView, NSImage, CGImageRef, etc that shows the QuickLook preview for a file. Essentially the equivalent of QLThumbnailImageCreate() but for the preview.

The public APIs I can find do not support this. They allow the creation of a thumbnail image or a QLPreviewPanel. The panel does in fact display the quick look preview, but I cannot get access to the preview's appearance to embed it in other views, nor can I display multiple previews at once.

For background, I am writing an app where users can embed links to other files that should be displayed inline, kind of like an <img> tag in HTML. For images like JPGs and PDFs it's easy to figure out what to display. I thought that for other formats I would use Quick Look to generate a nice visual representation of the file's contents. This way the set of formats supported by my application would be easily extensible (just download new Quick Look generators).

© Stack Overflow or respective owner

Related posts about quicklook

Related posts about cocoa