I have this code
let img= html2canvas($("#divPage")[0], {
onrendered: function(canvas) {
var myImage = canvas.toDataURL("image/png");
return myImage;
},
allowTaint: true,
taintTest: false
});
img.then((value) => {
console.log(value);
window.open(value);
});
window.open(value);
open a new tab with the link https://www1.inscription.tn/ORegMx/servlet/[object%20HTMLCanvasElement]
so the problem is let img
is in the wrong place, it let the method return the object which is the HTMLCanvasElement instead of returning the image data url returned from onrendered: function(canvas)
I've checked these answers:
Why is my asynchronous function returning Promise { } instead of a value?
How can i fix that in order to get the correct value ?
Hope someone can help,
Thanks