html2canvas无法捕捉图像 [英] html2canvas not capturing image

查看:201
本文介绍了html2canvas无法捕捉图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

html2canvas.js没有捕获图像。它会在图像出现的地方留下空白。

 函数capture()
{
html2canvas(document。 body,{
allowTaint:true,
logging:true,
onrendered:function(canvas){
imagestring = canvas.toDataURL(image / png);
console.log(imagestring);
document.body.appendChild(canvas);
}
});
}

我试了很多,但找不到解决方案。



帮助表示赞赏:)

解决方案

。安全限制会导致它失败。


html2canvas.js not capturing image. it leaves white space where the image occurs.

function capture()
{
    html2canvas(document.body, {
        allowTaint: true,
        logging:true,
        onrendered: function(canvas) {
        imagestring = canvas.toDataURL("image/png");
        console.log(imagestring);
        document.body.appendChild(canvas);
        }
    });
}

I have tried a lot but i cannot find solution .

Help is appreciated :)

解决方案

It works, when I host it in the server. The security restrictions causes it to fail.

这篇关于html2canvas无法捕捉图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆