You are overwriting the canvas element html2canvas is providing. Try to use that argument directly:
onrendered: function (canvas) // <- use this argument
{
/// This is overwriting the rendered canvas
//var canvas = document.getElementById('canvas');
$.post("save.php",
{
data: canvas.toDataURL("image/jpeg")
},
function (file)
{
window.location.href = "download.php?path="+ file
});
})
From the documentation:
The rendered canvas is provided in the callback event onrendered, as such:
html2canvas(element, { onrendered: function(canvas) { // canvas is the final rendered <canvas> element } });