You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

NReco PdfGenerator实现PDF每页重复用户信息并显示页码

NReco PdfGenerator 对账单分页重复用户信息及页码显示问题

我使用NReco PdfGenerator开发客户对账单,流程是先制作HTML页面再转换为PDF文件。当前生成的PDF中,当记录增多需要分页时,仅报表区域会在每页重复,用户信息仅在首页显示。我需要实现用户信息区域每页重复显示,同时让其中的Page No字段展示正确页码。尝试过将用户信息与报表放入同一Div并添加CSS样式.divRepeat{display: table-header-group;},但未达到预期效果,请求技术帮助。

相关HTML代码

<b>User Information Section</b>
    <table style="border-collapse: collapse; width: 100%; border-style: none;" cellspacing="0" cellpadding="0">
        <tbody>
            <tr style="padding-right: 15px; font-family: Cairo ; font-size: 12pt;">
                <td style="width:">
                    <table>
                        <tbody>
                            <tr>
                                <td style="font-size:11pt;font-weight:bold">Name</td>
                                
                                <td>:</td>
                            </tr>
                        </tbody>

                    </table>

                </td>
                <td style="width:">

                    <div style="text-align: left;font-size: 11pt;padding-left: 10px;padding-right: 10px;font-weight:bold">
                        jeorge
                    </div>
                </td>
                
            </tr>
            <tr style="padding-right: 15px; font-family: Cairo ; font-size: 12pt;">
                <td style="width:">
                    <table>
                        <tbody>
                            <tr>
                                <td style="font-size:11pt;font-weight:bold">Cus NO</td>
                                
                                <td>:</td>
                            </tr>
                        </tbody>

                    </table>

                </td>
                <td style="width:">

                    <div style="text-align: left;font-size: 11pt;padding-left: 10px;padding-right: 10px;font-weight:bold">
                        445026
                    </div>
                </td>
                
                <td style="width:">

                    <table>
                        <tbody>
                            <tr>
                                <td style="font-size:11pt;font-weight:bold">Date</td>
                                
                                <td>:</td>
                            </tr>
                        </tbody>

                    </table>
                </td>
                <td style="width: ">

                    <div style="text-align: left;font-size: 11pt;padding-left: 10px;padding-right: 10px;font-weight:bold">
                        30/11/22
                    </div>
                </td>
                
            </tr>
            <tr style="padding-right: 15px; font-family: Cairo ; font-size: 12pt;">
                <td style="width:">

                    <table>
                        <tbody>
                            <tr>
                                <td style="font-size:11pt;font-weight:bold">Invoice No</td>
                                <td></td>
                                <td>:</td>
                            </tr>
                        </tbody>

                    </table>
                </td>
                <td style="width:">

                    <div style="text-align: left;font-size: 11pt;padding-left: 10px;padding-right: 10px;font-weight:bold">
                        1094093
                    </div>
                </td>
                
                <td style="width:">

                    <table>
                        <tbody>
                            <tr>
                                <td style="font-size:11pt;font-weight:bold"><b>Page No</b></td>
                                
                                <td>:</td>
                            </tr>
                        </tbody>

                    </table>
                </td>
                <td style="width: ">
                    <div id="pageCounter">
                        <span></span>
                    </div>
                    <div id="pageNumbers" style="text-align: left;font-size: 11pt;padding-left: 10px;padding-right: 10px;font-weight:bold">
                        <div></div>
                    </div>
                </td>
                
            </tr>


        </tbody>
    </table>
    <br />
    <b>Statement Section</b>
    <table style="border-collapse: collapse;width: 100%;border-width: thin;color:black;margin-top:1px" border="1" bordercolor="black" cellspacing="0" cellpadding="0">
        <thead>
            <tr style="background-color: #f1f1f1;font-family: Cairo ;color: black;font-size:11pt;font-weight:bold">
                <td style="width: 5%;  text-align: center; ">
                    
                    <br /> Cust_No
                </td>
                
                <td style="width: 10%;  text-align: center;font-size:11pt;font-weight:bold">
                    
                    <br />Date
                </td>
                <td style="width: 10%;  text-align: center;font-size:11pt;font-weight:bold ">
                    
                    <br /> Qty
                </td>
                <td style="width: 10%;  text-align: center;font-size:11pt;font-weight:bold">
                    
                    <br /> Price
                </td>
                
            </tr>
        </thead>
        <tfoot>
            <tr>
                <td style="width: 10%; border: solid windowtext 1pt; border-top: none;border-right:none; border-color: black;"></td>
                <td style="width: 40%; border-top: none; border-left: none;border-right:none;  border-bottom: solid windowtext 1pt;border-color: black;"></td>
                <td style="width: 15%; border-top: none; border-left: none; border-bottom: solid windowtext 1pt; border-right:none; border-color: black;"></td>
                <td style="width: 10%; border-top: none; border-left: none; border-bottom: solid windowtext 1pt; border-right: none;border-color: black;"></td>
                
                
            </tr>
        </tfoot>
        <tbody>
            <tr>
            <tr class="table_cell" style="font-family: Cairo ;font-size:9.5pt;line-height:0.5;">
                <td class="table_cell" style="width: 10%;color:black;border-color:black">
                    676767
                </td>
                
                <td class=" table_cell" style="width: 15%;color:black;border-color:black">
                    01/11/22
                </td>
                <td class="table_cell" style="width: 10%;text-align:right;color:black;border-color:black">
                    1
                </td>
                <td class="table_cell" style="width: 10%;text-align:right;color:black;border-color:black">
                    290.70
                </td>
                
            </tr>
            <tr class="table_cell" style="font-family: Cairo ;font-size:9.5pt;line-height:0.5;">
                <td class="table_cell" style="width: 10%;color:black;border-color:black">
                    353535
                </td>
                
                <td class=" table_cell" style="width: 15%;color:black;border-color:black">
                    02/11/22
                </td>
                <td class="table_cell" style="width: 10%;text-align:right;color:black;border-color:black">
                    1
                </td>
                <td class="table_cell" style="width: 10%;text-align:right;color:black;border-color:black">
                    343.81
                </td>
                
            </tr>

        </tbody>
    </table>

原有CSS代码

body {
            margin: 20px;
        }

        table {
            page-break-inside: auto;
        }

        tr {
            page-break-inside: avoid;
            page-break-after: auto;
        }

        thead {
            display: table-header-group;
        }

        tfoot {
            display: table-footer-group;
        }

        #content {
            flex: 1 1 auto;
        }

尝试的额外CSS代码

.divRepeat{
            display: table-header-group;
        }

内容的提问来源于stack exchange,提问作者vivek v

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 00:48:20