改善数据表打印

时间:2015-10-26 22:53:15

标签: javascript css highcharts

我有一个页面,我需要打印图表(svg元素)和一个html表。这里的一切都很好......我在这里的小问题是桌子 没有使用页面中可用的总宽度进行打印,也没有采用表格的样式。 这是我的代码:

  public print() {
        var popUpAndPrint = function () {
            var container = $('#container');
            var keyNumbers = $('#HtmlTableDIV');
            var mySVG: any = $("#container div svg");
            keyNumbers.appendTo(container);
            var width: any = mySVG.width();
            var height = mySVG.height();
            var printWindow = window.open('', 'PrintMap',
                'width=' + width + ',height=' + height);
            printWindow.document.writeln(container.html());
            printWindow.document.close();
            printWindow.print();
            printWindow.close();
        };
        setTimeout(popUpAndPrint, 500);
    }

结果如下:in the browser

enter image description here

0 个答案:

没有答案