Is it possible to use getElementByID to only print a specific element to canvas?
Using the latest version and it will only work with document.body
$("#myButton").click(function () {
html2canvas(document.getElementById('myTable'), {
allowTaint: true,
imageTimeout: 15000,
logging: true,
useCORS: true
}).then(function (canvas) {
document.body.appendChild(canvas);
const b64 = canvas.toDataURL("image/png").replace(/.*,/, '');
console.log("data:image/png;base64, " + b64)
});
});
Fixed by adding the following options
scrollX: -window.scrollX,
scrollY: -window.scrollY