Before you tell me that this is a duplicate question, know that I looked through one each one related question and none of the answers in any of them work me.
I use html2canvas to get a snapshot of a div, and I need to scale to 750x1050 before saving it to png via canvas.toDataURL().
Closest I got the following code.
html2canvas(document.getElementById('div_id'), {
onrendered: function(canvas) {
var extra_canvas = document.createElement("canvas");
extra_canvas.setAttribute('width', 750);
extra_canvas.setAttribute('height', 1050);
var ctx = extra_canvas.getContext('2d');
ctx.drawImage(canvas, 0, 0, 750, 1050);
var dataURL = extra_canvas.toDataURL();
window.open(dataURL);
}
});
The image was set up correctly, but the text inside the image was extremely low, as if it had resized after turning into png.
Is it that I am doing something wrong, or you simply cannot scale in this way?
/!