새소식

Program Language

[Solved] html2canvas Tainted canvases may not be exported​​

  • -
728x90

This worked for me!

I use html2canvas.
And I wrote allowtain and useCORS options.

//html2canvas and download
var canvasPromise  = html2canvas(document.getElementById("myHTML"), {
    allowTaint: true,
    useCORS: true,
    foreignObjectRendering: true
});
canvasPromise.then(function(canvas) {
	var myImage = new Image;
	myImage.crossOrigin="anonymous"
	myImage = canvas.toDataURL();
});

 

Don't forget to describe crossOrigin="anonymouse" in the image!

I hope this article will help you :)

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.