Take a look at the html2canvas project. Their approach is to create a page view inside the canvas. They do not take the actual screenshot, but build it based on the content on the page and the loaded stylesheet. It can be used for the whole body or only for a specific element.
It is also very easy to use. Here is an example:
html2canvas(document.body, { onrendered: function(canvas) { document.body.appendChild(canvas); } });
You can easily adapt it to your code.
Take a look at the demo. Click on any of the buttons, and then scroll to the end.
source share