I am using html2canvas to convert a div on a canvas. Like this:
I had same problem. Problem is happened when I tried to use canvas inside a hidden element. In my case I am using Bootstrap modal and the canvas inside it.
Solution is: "Implement canvas codes after element is fully visible".
In my case I have to use $('.modal').on('shown.bs.modal', function(){}) instead of $('.modal').on('show.bs.modal', function(){}), because modal element is fully appeared on shown.bs.modal event ; )