generate browser window screenshot
I have to work with multiple pages (tabs) at once and need to see how the different pages look like at any one instance. Is it possible to take screen shots of open tab in Firefox/Chrome via Javascript?
On Chrome, use the Aviary extension: if you require programmatic access, you could fork from the said extension to provide an API.
There is also the captureVisibleTab
tabs function available through Chrome extension: it does all the work (almost ;-) for you.
If you like to do it programmatically with WebKit you could use:
http://www.phantomjs.org
Here is how it works:
PhantomJS is a command-line tool that packs and embeds WebKit. Literally it acts like any other WebKit-based web browser, except that nothing gets displayed to the screen (thus, the term headless). In addition to that, PhantomJS can be controlled or scripted using its JavaScript API.
Here is an example:
$>./panthomjs.exe rasterize.js http://www.google.com google.png
精彩评论