Please make sure you are testing with the latest release of html2canvas.
Old versions are not supported and issues reported for them will be closed.
The image is getting cut off at either the bottom or top depending on the scroll position.
html2canvas(document.querySelector(".canvas"), {
width: 768,
height: 370,
windowWidth: document.querySelector(".canvas").scrollWidth,
windowHeight: document.querySelector(".canvas").scrollHeight,
scrollX: 0,
scrollY: -window.scrollY,
x: 0,
scale: 3
}).then(canvas => {
console.log(canvas);
var base64image = canvas.toDataURL("image/jpeg");
saveAs(base64image, 'image.jpg');
});
I am experiencing the same problem. I've traced the problem that it started to occur from version 1.0.0-rc.2, rc.1 is ok, if it helps.
I am experiencing the same problem. I've traced the problem that it started to occur from version 1.0.0-rc.2, rc.1 is ok, if it helps.
Ye seems to work on 1.00-rc.2 so something changed since then...
I noticed the same thing
Ye seems to work on 1.00-rc.2 so something changed since then...
Nope, I tested all RCs 1-5 - the only one that not infected with the bug is RC1.
And all workarounds mentioned in https://github.com/niklasvh/html2canvas/issues/1878 wont help, unfortunately.
I also did the test, I can confirm it
Also experiencing the issue. I have made some research and can tell that for relatively complex webpage constructed with JS components this thing happens every second test run with _random_ width of white stripe.
Moreover, when Network Speed throttling is turned on in DevTools (for instance Fast 3G preset is used), the issue can't be seen, which makes me think that it can be caused by some race condition bug inside the renderer.
Tested on Chrome 79 in Mac OS X 10.15.2
I fixed this problem by saving the scroll position (x and y), move the page to x=0 y=0, invoke the method and restore the position, it solved the problem
Most helpful comment
I fixed this problem by saving the scroll position (x and y), move the page to x=0 y=0, invoke the method and restore the position, it solved the problem