html2canvas不是全长 - 文本被切断

时间:2016-11-01 23:12:13

标签: javascript canvas html2canvas

我真的很难让html2canvas得到全长。

生成的图像总是在中途切断。无论文本中有什么内容,我都无法显示文本的全长。

无论如何修复/调试这个?

我的代码

$('body').append('<div id ="htmlTextBoxHolder">'+text+'</div>');


$('#htmlTextBoxHolder').css({
    'width': '1200px',
    'background-color':'#ffffff',
    'color': '#000000',
    'font-size': '60px'
});


html2canvas($("#htmlTextBoxHolder"), {
    onrendered: function(canvas) {

        var img = canvas.toDataURL();
        window.open(img);


        $('#posterHolder').empty();


    },

    width: $('#htmlTextBoxHolder').width(),
    height: $('#htmlTextBoxHolder').height()
});

1 个答案:

答案 0 :(得分:0)

Body有overflow:hidden属性。我把它添加到别的东西,它很好。

相关问题