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 matlab有关常微分方程的问题求解决
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?
    • ¥100 求三轴之间相互配合画圆以及直线的算法
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable