This script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.
It does <b>not require any rendering from the server</b>, as the whole image is created on the <b>clients browser</b>. However, as it is heavily dependent on the browser, this library is *not suitable* to be used on for example on node.js.
It doesn't magically circumvent and browser content policy restrictions either, so rendering cross origin content will require a <ahref="https://github.com/niklasvh/html2canvas/wiki/Proxies">proxy</a> to get the content to the <ahref="http://en.wikipedia.org/wiki/Same_origin_policy">same origin</a>.
The script is still in a **very experimental state**, so I don't recommend using it in a production environment nor start building applications with it yet, as there will be still major changes made.
The library uses <ahref="http://gruntjs.com/">grunt</a> for building. Alternatively, you can download ready builds from the <ahref="https://github.com/niklasvh/html2canvas/downloads">downloads page</a>.
Run the full build process (including lint, qunit and webdriver tests):
The library has two sets of tests. The first set is a number of qunit tests that check that different values parsed by browsers are correctly converted in html2canvas. To run these tests with grunt you'll need <ahref="http://phantomjs.org/">phantomjs</a>.
The other set of tests run Firefox, Chrome and Internet Explorer with <ahref="https://github.com/niklasvh/webdriver.js">webdriver</a>. The selenium standalone server (runs on Java) is required for these tests and can be downloaded from <ahref="http://code.google.com/p/selenium/downloads/list">here</a>. They capture an actual screenshot from the test pages and compare the image to the screenshot created by html2canvas and calculate the percentage differences. These tests generally aren't expected to provide 100% matches, but while commiting changes, these should generally not go decrease from the baseline values.
For more information and examples, please visit the <ahref="http://html2canvas.hertzen.com">homepage</a> or try the <ahref="http://html2canvas.hertzen.com/screenshots.html">test console</a>.
If you wish to contribute to the project, please send the pull requests to the develop branch. Before making any changes, make sure to run the webdriver tests to create the baseline results. If some CSS property isn't supported or is incomplete, please create appropriate tests for it as well before submitting any code changes.
* Added support for CORS images and option to create canvas as tainted (<ahref="https://github.com/niklasvh/html2canvas/commit/3ad49efa0032cde25c6ed32a39e35d1505d3b2ef">niklasvh</a>)
* Added integrated support for Flashcanvas (<ahref="https://github.com/niklasvh/html2canvas/commit/e9257191519f67d74fd5e364d8dee3c0963ba5fc">niklasvh</a>)
* Fixed a variety of legacy IE bugs (<ahref="https://github.com/niklasvh/html2canvas/commit/b65357c55d0701017bafcd357bc654b54d458f8f">niklasvh</a>)
* Option to select single element to render (<ahref="https://github.com/niklasvh/html2canvas/commit/0cb252ada91c84ef411288b317c03e97da1f12ad">niklasvh</a>)