Skip to content

Commit be14393

Browse files
committed
added usage example
1 parent d6cb548 commit be14393

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

readme.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ Note that the compatibility will most likely be increased in future builds, as m
3131
There are still a lot of CSS properties missing, including most CSS3 properties such as <code>text-shadow</code>, <code>box-radius</code> etc. as well as all elements created by the browser, such as radio and checkbox buttons and list icons. I will compile a full list of supported elements and CSS properties soon.
3232
There is no support for <code>frame</code> and <code>object</code> content such as Flash.
3333

34+
### Usage ###
35+
To render an `element` with html2canvas, simply call:
36+
` html2canvas( [ element ], options);`
37+
38+
To access the created canvas, provide the `onrendered` event in the options which returns the canvas element as the first argument, as such:
39+
40+
html2canvas( [ document.body ], {
41+
onrendered: function( canvas ) {
42+
/* canvas is the actual canvas element,
43+
to append it to the page call for example
44+
document.body.appendChild( canvas );
45+
*/
46+
}
47+
);
48+
49+
3450
### Examples ###
3551

3652
For more information and examples, please visit the <a href="http://html2canvas.hertzen.com">homepage</a> or try the <a href="http://html2canvas.hertzen.com/screenshots.html">test console</a>.
@@ -39,7 +55,7 @@ For more information and examples, please visit the <a href="http://html2canvas.
3955

4056
v0.34 - 26.6.2012
4157

42-
* Removed (last?) jQuery dependencies
58+
* Removed (last?) jQuery dependencies (<a href="https://github.com/niklasvh/html2canvas/commit/343b86705fe163766fcf735eb0217130e4bd5b17">niklasvh</a>)
4359
* Radial gradients (<a href="https://github.com/niklasvh/html2canvas/commit/4f22c18043a73c0c3bbf3b5e4d62714c56acd3c7">SunboX</a>)
4460
* Split renderers to their own objects (<a href="https://github.com/niklasvh/html2canvas/commit/94f2f799a457cd29a21cc56ef8c06f1697866739">niklasvh</a>)
4561
* Simplified API, cleaned up code (<a href="https://github.com/niklasvh/html2canvas/commit/c7d526c9eaa6a4abf4754d205fe1dee360c7660e">niklasvh</a>)

0 commit comments

Comments
 (0)