Html <;thead>;及<;tfoot>;打印在webkit的每一页上

Html <;thead>;及<;tfoot>;打印在webkit的每一页上,html,css,webkit,rotativa,Html,Css,Webkit,Rotativa,WebKit仅在第一页打印和。根据和: 打印长表格时,包含表格数据的每一页上都可能重复表格的头部和底部信息 我们正在使用基于WebKit的Rotativa来呈现PDF,并且存在thead和tfoot不能在每个页面上呈现的问题 是否有任何解决方法或切换来解决此问题 开始破解 最后,我使用以下JS脚本将我的表拆分为多个页面: <script> function splitTable(table, maxHeight, firstPageMaxHeight) { v

WebKit仅在第一页打印
。根据


打印长表格时,包含表格数据的每一页上都可能重复表格的头部和底部信息

我们正在使用基于WebKit的Rotativa来呈现PDF,并且存在
thead
tfoot
不能在每个页面上呈现的问题


是否有任何解决方法或切换来解决此问题

开始破解

最后,我使用以下JS脚本将我的表拆分为多个页面:

<script>
    function splitTable(table, maxHeight, firstPageMaxHeight) {
        var header = table.children("thead");
        if (!header.length)
            return;

        var headerHeight = header.outerHeight();
        var header = header.detach();

        var splitIndices = [0];
        var rows = table.children("tbody").children();

        maxHeight -= headerHeight;
        var currHeight = 0;
        var firstPage = true;
        rows.each(function (i, row) {
            currHeight += $(rows[i]).outerHeight();
            if (firstPage) {
                currHeight += (maxHeight - firstPageMaxHeight);
                firstPage = false;
            }
            if (currHeight > maxHeight) {
                splitIndices.push(i);
                currHeight = $(rows[i]).outerHeight();

            }
        });
        splitIndices.push(undefined);

        table = table.replaceWith('<div id="_split_table_wrapper"></div>');
        table.empty();

        for (var i = 0; i < splitIndices.length - 1; i++) {
            var newTable = table.clone();
            header.clone().appendTo(newTable);
            $('<tbody />').appendTo(newTable);
            rows.slice(splitIndices[i], splitIndices[i + 1]).appendTo(newTable.children('tbody'));
            newTable.appendTo("#_split_table_wrapper");
            if (splitIndices[i + 1] !== undefined) {
                $('<div style="page-break-after: always; margin:0; padding:0; border: none;"></div>').appendTo("#_split_table_wrapper");
            }
        }
    }

    $(document).ready(function () {
        splitTable($(".po-report"), 2100, 600);
    });
</script>

函数拆分表(表,最大高度,第一页最大高度){
var header=表的子项(“thead”);
如果(!header.length)
返回;
var headerHeight=header.outerHeight();
var header=header.detach();
var指数=[0];
变量行=table.children(“tbody”).children();
最大高度-=人头高度;
var currHeight=0;
var firstPage=true;
行。每个(函数(i,行){
currHeight+=$(行[i]).outerHeight();
如果(第一页){
currHeight+=(最大高度-第一页最大高度);
第一页=假;
}
如果(当前高度>最大高度){
推挤(i);
currHeight=$(行[i]).outerHeight();
}
});
splitindex.push(未定义);
表=表。替换为(“”);
table.empty();
对于(var i=0;i

END HACK

“打印长表时,可能会在包含表数据的每一页上重复表头和表脚信息。”-不要求用户代理重复这些信息,因此将其称为bug是错误的。“可能”、“必须”等的原始定义确实有帮助吗?不幸的是,没有。它在WebKit中不起作用。我认为没有解决这个问题的方法。您可以检查Rotativa是否存在功能请求或问题,如果没有,则在那里打开问题。可能有链接到或,也可能