我正在将 div 转换为图像,并且 div 正在编写“古吉拉特语”语言,但是当我尝试将此 div 转换为图像时,不会出现正确的输出。
这是我的代码::
<script type="text/javascript">
function ConverToImage() {
var container1 = document.getElementById('container1');
var img = $('#<%= img.ClientID %>')
var hfData = $('#<%= hfData.ClientID %>')
html2canvas(container1, {
onrendered: function(canvas) {
$('.img_val').val(canvas.toDataURL("image/png"));
img.css("display", "block");
img.attr("src", img_val.value);
hfData.attr('value', img_val.value);
}
});
}
</script>
<div class="senctionLetter" id="container1">
......containing "Gujarati"
</div>
<input type="hidden" id="img_val" class="img_val" />
<input id="btnSave" type="button" value="Generate Image" onclick="ConverToImage();" />
<img id="img" runat="server" src="" alt="" style="display: none" />
<asp:Button ID="btn" runat="server" Style="display: none;" OnClick="imgbtnYes_Click" />
<asp:HiddenField ID="hfData" runat="server" />