使用html2canvas进行阿拉伯语编码

mfa*_*del 8 jquery encoding html2canvas

我正在使用html2canvas一个div的图像,内容来自同一页面,相同的域名,但它显示阿拉伯字母断开连接,似乎html2canvas不支持阿拉伯语.

当我在其网页上阅读有关它的可用详细信息时,我没有找到任何有用的信息.

这是我使用的简单代码:

$("#import").click(function(){
    // send the contents of the email :)
    html2canvas(document.body, {
        onrendered: function(canvas) {
            document.body.appendChild(canvas);
        },
        letterRendering:true
    });
});
Run Code Online (Sandbox Code Playgroud)

html2canvas如何呈现div

任何线索?

Han*_*man 5

我想尝试一些代码操作 & 它令人难以置信地工作。答案是替换:

textList = (!options.letterRendering && /^(left|right|justify|auto)$/.test(textAlign) && noLetterSpacing(getCSS(el, "letterSpacing")))
Run Code Online (Sandbox Code Playgroud)

和:

textList = (!options.letterRendering || /^(left|right|justify|auto)$/.test(textAlign) || noLetterSpacing(getCSS(el, "letterSpacing")))
Run Code Online (Sandbox Code Playgroud)

注意 (&&) 符号被 (||) 替换。


小智 0

您使用的是 UTF-8 编码吗?如果你没有<meta http-equiv="content-type" content="text/html; charset=UTF8">脑子,那肯定行不通:)希望这会有所帮助。