0

I'm trying to convert HTML to picture using html2canvas. The problem is that arabic characters didn't convert correctly !

</html>
<body dir="rtl">
    <a class="STO_one" href="#">
        <span><b> بسم الله الرحمن الرحيم </b> </span>
    </a>
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="js/html2canvas.js"></script>
    <script>
        html2canvas(document.body, {
            onrendered: function(canvas) {
                document.body.appendChild(canvas);
            }
        });
    </script>
</body>
</html>
Paweł Tomkiel
  • 1,974
  • 2
  • 21
  • 39

2 Answers2

1

if you do not have following attribute in the style sheet it will not work with you "text-align: right;" it MUST be right.

For Ex. <span><b style="text-align: right"> بسم الله الرحمن الرحيم </b> </span>

Moghrabi
  • 11
  • 1
  • Thank you so much, I've been searching for a solution for a week now!, I want to say that this will not work if you have `letterRendering:true`, remove it and this will work :D – Ahmad Yousef Jun 12 '17 at 23:55
-1

Try with adding letterRendering:true in your code as follow

<script>
            html2canvas(document.body, {
                onrendered: function(canvas) {
                    document.body.appendChild(canvas);
                },
              letterRendering:true
            });
    </script>
Mahesh
  • 1,063
  • 1
  • 12
  • 29