当DIV数量显着增加时,Html2Canvas无法正确渲染多个DIV

时间:2016-06-27 09:19:50

标签: javascript css canvas html2canvas

我想从表格(HTML)渲染多行。将一行渲染为一个图像(在附加图像中提到像image1,image2 ......这样的标签)。表在运行时生成。

我尝试过以下代码,但没有效果。

html2canvas($('.row.indicator-table-header'), { // render table header image
onrendered: function(canvas) {
    indicatorTable=canvas.toDataURL("image/png");
    var indi=0;
    indicatorTableBodyImage();
    console.log('Start0 : '+indi);  

    function indicatorTableBodyImage() {
        indi++; 
        console.log('Start1 : '+indi);  
        if(indi == indicatorTableBodyLength) {
            console.log('Start3 : '+indi);

            form_submit('test_image_report', {
                indicatorTableBodyArray : indicatorTableBodyArray
            }, 
            'post');
        }
        console.log('Start4 : '+indi);  

html2canvas($('.row.indicator-table-body'), {  // render table body image
    onrendered: function(canvas) {
        console.log('Start5 : '+indi);
            indicator_table_body=canvas.toDataURL("image/png");
            indicatorTableBodyArray[indi] = indicator_table_body;
            indicatorTableBodyImage();
            console.log('Start6 : '+indi);


    }});
console.log('Start7End : '+indi);
    } // close of for loop

}});

HTML页面如下: HTML Table which i want to render as image

html2canvas not working for multiple div as canvas

0 个答案:

没有答案