Screenshot Your Web Page
This is a very straight forward sample to get a screenshot to a PNG.
<html>
<head>
<!-- Keep these scripts in order! -->
<script type="text/javascript" src="http://html2canvas.hertzen.com/js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="http://html2canvas.hertzen.com/js/html2canvas.js"></script>
<script type="text/javascript" src="http://html2canvas.hertzen.com/js/jquery.plugin.html2canvas.js"></script>
<!-- -->
<script type="text/javascript">
function ss() {
$("#content").html2canvas({
canvas: hidden_screenshot,
onrendered: function() {alert($("canvas")[0].toDataURL('image/png'));}
});
}
</script>
</head>
<body>
<div id="content"><h1>Screenshot Demo</h1><input type=button value="Screenshot" onclick="javascript:ss();" /><br /><br /></div>
<canvas id="hidden_screenshot" style="display:none;" />
</body>
</html>
Comments