Search code examples
javascriptphphtml2canvas

Html2Canvas not rendering image properly


Here is my code, and i am not getting proper Image, specially in Crome.

function capture(){
    html2canvas(document.querySelector(".pc_table"), {
      logging: true, 
      letterRendering: 1, 
      allowTaint: true,
      useCORS: true 
    }).then(canvas => {
      console.log(canvas.toDataURL("image/jpeg", 0.9));
    })
}

Sometimes Image render Properly (URL: https://www.gadgetlnn.com.bd/index.php?route=product/pcbuilder) click on capture, but mostly Image is like IMG I tried a lot of things like: https://github.com/niklasvh/html2canvas/issues/722 but nothing works fine. Any Help will be appreciated.


Solution

  • This is because of the broken images. I simply make to load images correctly. And it worked out.