Reputation: 11
Configure the height of the generated canvas as follows , but the height of the actual generated canvas is the pixel height of the screen. I don't know why. Width also does not take effect
var opts = {
logging: true,
useCORS: true,
height:500,
};
html2canvas(dom, opts).then(canvas =>{
...
})
Upvotes: 0
Views: 3031
Reputation: 11
The problem is solved,directly pass a canvas with its own width and height.
var canvas = document.createElement('canvas');
canvas.width = 500;
canvas.height = 500;
var opts = {
canvas : canvas,
logging: true,
useCORS: true,
};
html2canvas(dom, opts).then(canvas =>{
...
})
Upvotes: 1