I have below code
window.scrollTo(0, 0);
const totPage = document.getElementsByClassName('print');
for (let index = 1; index < totPage.length;) {
const input = totPage[index]
let orn = input.getAttribute('orientation');
let canvas = await html2canvas(input,{
windowWidth: input.scrollWidth,
windowHeight: input.scrollHeight
});//.then((canvas) => {
const imgData = canvas.toDataURL('image/png');
console.log(imgData)
index++
}
it generates pdf with image cut off. but strangely when I open console on browser and then try it generates images perfectly, and after then even I closed the console the images are generating correctly. its strange but cannot figure out why this is happening