I have a html tag canvas.
<canvas id="myCanvas"></canvas>
I can draw on it successfully, and it looks really good, as i wanted to be. The problem is on the conversion to png.I use html2canvas for that with Canvas2Image. The html2canvas consoles logs an error: Uncaught (in promise) undefined. Canvas2Image console logs Uncaught (in promise) DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0. I can understand the error very well, the canvas has width and height != 0. Any ideas?
html2canvas code:
html2canvas(document.getElementById('myCanvas')).then(canvas9 => {
var theimage9 = Canvas2Image.convertToPNG(canvas9);
var imageData9 = $(theimage9).attr('src');
console.log(imageData9);
});