使用UTF-8字符的Html2canvas图像捕获问题 [英] Html2canvas image capturing issue with UTF-8 characters

查看:113
本文介绍了使用UTF-8字符的Html2canvas图像捕获问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想抓住我的网页,为了这个我发现html2canvas,当我使用如下所示时,我的UTF-8(波斯语)字符遇到麻烦,这个方向被破坏了。

I want to capture my webpage, In order to this I find html2canvas, when I use as shown below ,my UTF-8 (persian) characters get in trouble and this direction destroyed as you see.

HTML:

   <div id="wrapper">
        <span>این کاراکتر ها بهم میریزند</span>
    </div>

JavaScript:

JavaScript:

$(document).ready(function() {
    html2canvas($("#wrapper"), {
        onrendered: function (canvas) {
            theCanvas = canvas;

            document.body.appendChild(canvas);

            canvas.toBlob(function (blob) {
                saveAs(blob, "Dashboard.png");
            });
        }
    });     
});

网页:

通过html2canvas捕获的网页:

Captured WebPage via html2canvas:

你可以看到完整的例子这里

you can see full example here

我的实施有什么问题?

推荐答案

这是html2canvas的错误(使用html2canvas进行阿拉伯语编码,可以通过设置 text-align:left

This is a bug with html2canvas (Arabic Encoding with html2canvas) and can be fixed by setting text-align: left on your wrapper element.

这是一个更新的小提琴
http: //jsfiddle.net/ydeL72m8/1/

Here's an updated fiddle http://jsfiddle.net/ydeL72m8/1/

这篇关于使用UTF-8字符的Html2canvas图像捕获问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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