dongzhoulong1797 2019-05-16 08:20
浏览 224

MPDF添加分页内嵌套表

I need to add a page breaking inside Nested Table in MPDF is it possible?.

This is working with single table page break(multiple pages).

        <?php
        $html='<table  border="1" width="100%" cellpadding="0" cellspacing="0">
                <tbody>
                <tr>
                <td width="20" align="center"><strong>No</strong></td>
                <td style="min-width:300px" align="center"><strong>Name</strong></td>
                <td width="100" align="center"><strong>Qty</strong></td>
                <td width="100" align="center"><strong>Unit Price</strong></td>
                </tr>';
                for($i=1;$i<=70;$i++){
            $html.='  <tr>
                    <td align="center" ><strong>'.$i.'.</strong></td>
                    <td align="left"><strong>CAR MAINTENANCE</strong><br></td>
                    <td align="center">12.00</td>
                    <td align="center">1,000.00</td>
                    </tr>';
                     }
        $html .=' </tbody></table>';

        include("mpdf60/mpdf.php");
        $mpdf=new mPDF();

        $mpdf->SetDisplayMode('fullpage');

        $mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list

        $html1=mb_convert_encoding($html, 'UTF-8', 'UTF-8');

        $mpdf->WriteHTML($html1);

        $mpdf->Output();

        exit;

output screenshot: enter image description here

While, This is not working while using a Nested Table

        <?php
        $html='<table  border="1" width="100%" cellpadding="0" cellspacing="0">
                <tbody>
                <tr>
                <td>

          <table  border="1" width="100%" cellpadding="0" cellspacing="0">
                <tbody>
                <tr>
                <td width="20" align="center"><strong>No</strong></td>
                <td style="min-width:300px" align="center"><strong>Name</strong></td>
                <td width="100" align="center"><strong>Qty</strong></td>
                <td width="100" align="center"><strong>Unit Price</strong></td>
                </tr>';
                for($i=1;$i<=70;$i++){
            $html.='  <tr>
                    <td align="center" ><strong>'.$i.'.</strong></td>
                    <td align="left"><strong>CAR MAINTENANCE</strong><br></td>
                    <td align="center">12.00</td>
                    <td align="center">1,000.00</td>
                    </tr>';
                     }
        $html .=' </tbody></table>
        </td></tr>
        </tbody></table>';

        include("mpdf60/mpdf.php");
        $mpdf=new mPDF();

        $mpdf->SetDisplayMode('fullpage');

        $mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list

        $html1=mb_convert_encoding($html, 'UTF-8', 'UTF-8');

        $mpdf->WriteHTML($html1);

        $mpdf->Output();

        exit;

output screenshot :enter image description here

I need a page breaking inside Main table td to break page(if large nested table data) and in nested table tr page break( while,single table working perfect!) also

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog