IMGKit
IMGKit copied to clipboard
Is there a way to take snapshot of a website when it's fully loaded?
My Code :
resource = Resource.find_by_id(resource_id)
kit = IMGKit.new(url, 'load-error-handling' => 'ignore')
img = kit.to_img(:png)
file = Tempfile.new("template_"+resource_id.to_s+'.png', 'tmp',
:encoding => 'ascii-8bit')
file.write(img)
file.flush
resource.image = file
if resource.save
file.unlink
end
When it makes snapshot of some website with loading, it immediately saves the loading screen to the image, is there way to wait until the website is fully loaded, then save it to image?
i am facing same issue.
same problem here, sometimes it generates without some images that were not loaded yet
Are those images loading via JS or via normal embeds like and css? You can tell
wkhtmltoimage
to wait for js with teh --javascript-delay <msec>
flag. Checkout wkhtmltoimage -H
for more resources.