Fork me on GitHub

Rendering the body element and appending the canvas to the body

html2canvas(document.body, {
  onrendered: function(canvas) {
    document.body.appendChild(canvas);
  }
});

Rendering the body element and restrict canvas size to 300x300px

html2canvas(document.body, {
  onrendered: function(canvas) {
    document.body.appendChild(canvas);
  },
  width: 300,
  height: 300
});