0

I'm trying to figure an easy way to create screenshots at 1200x800 from nearly one hundred HTML files using QuickLook. This line pretty much sums up with I'm doing:

CGImageRef imageRef = QLThumbnailImageCreate(NULL, (__bridge CFURLRef) [NSURL fileURLWithPath:layoutHtml isDirectory:NO], CGSizeMake(1280   , 800), (__bridge CFDictionaryRef) @{ (NSString*) kQLThumbnailOptionIconModeKey:@(NO)});

Unfortunately the create image does not contain any images used in the HTML file, I only get the question mark "image not found" placeholder. When I use QuickLook from the Finder, images get loaded.

Any ideas on how I could convince QLThumbnailImageCreate to include images?

Thanks, Ilja

iljawascoding
  • 1,090
  • 9
  • 20

1 Answers1

0

I don't think this is possible unless there is hidden Preview Property.

The Generating Enriched HTML also does not mention anything about loading external resources, only kQLPreviewPropertyAttachmentsKey which requires the HTML to use the cid:identifier URL scheme.

There is webkit2png which is a python script that does what you need. Searching for WebKit screenshot solution also brings up some Cocoa code snippets.

catlan
  • 25,100
  • 8
  • 67
  • 78
  • I ended up building a Cocoa UI app containing a WebView, from which I create the screenshots. Would have preferred my 50-line QuickLook approach in CodeRunner, though. – iljawascoding Nov 28 '13 at 10:57