自动分页而内容溢出 - MPDF

问题描述 投票:1回答:2

我使用MPDF PHP库来为我的发票的PDF格式。在发票我有产品,我使用表,列出清单。但是,当我的产品名单上获得PDF都增加了产品的挤压单页上。请帮忙。下面是我的代码

提前致谢。

<table width="100%" cellpadding="0" cellspacing="0">
    <tr>
        <td width="8%" class="left-stripes"></td>

        <td width="92%" class="right-invoice">
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="50%" class="billed-to-info">
                        Billed To,
                        <h3>Party Name</h3>
                        Party Detailed Address <br>
                        0124-234564 <br>
                    </td>
                    <td width="50%" align="right"><img src="<?php echo base_url(); ?>assets/img/tophead.jpg" class="topHeaderImageRight" /></td>
                </tr>
                <tr>
                    <td class="order-info" valign="top" style="padding-top: 20px;padding-left:10px;">
                        Order ID: #602 <br />
                        Delivery Date: 25 April 2016
                    </td>
                    <td class="billed-to-info" style="padding-top: 20px;">
                        <span>Billed By,</span>
                        <h3>Party Name</h3>
                        Party Address Details <br>
                        0712-277 4770 <br>
                    </td>
                </tr>
            </table>
            <br />

            <table width="100%" cellpadding="0" cellspacing="0" class="product-list-table">
                <tr style="background-color: #F5F5F5 !important;">
                    <th class="productinfo-header text-center"></th>
                    <th class="productinfo-header text-left">Item</th>
                    <th class="productinfo-header text-center">Mfg. Date</th>
                    <th class="productinfo-header text-center">Expiry Date</th>
                    <th class="productinfo-header text-right">QTY</th>
                    <th class="productinfo-header text-right">MRP</th>
                    <th class="productinfo-header text-right">Rate</th>
                    <th class="productinfo-header text-right">Total</th>
                </tr>
                <?php
                    for ($i=0; $i < 22; $i++) { 
                ?>
                <tr>
                    <td width="5%" class="productinfo-list text-center">1</td>
                    <td width="28%" class="productinfo-list text-left">Haldi Powder (100 gm)</td>
                    <td width="15%" class="productinfo-list text-center line-height-21">
                        01 Feb 16 (10) <br />
                        01 Mar 16 (30)
                    </td>
                    <td width="15%" class="productinfo-list text-center line-height-21">
                        01 Oct 16(10) <br />
                        01 Nov 16(30)
                    </td>
                    <td width="8%" class="productinfo-list text-right">40</td>
                    <td width="8%" class="productinfo-list text-right">60.00</td>
                    <td width="8%" class="productinfo-list text-right">55.23</td>
                    <td width="13%" class="productinfo-list text-right">5246.00</td>
                </tr>

                <tr>
                    <td class="productinfo-list text-center">12</td>
                    <td class="productinfo-list text-left">Haldi Powder (200 gm)</td>
                    <td class="productinfo-list text-center">01 Feb 16</td>
                    <td class="productinfo-list text-center">01 Oct 16</td>
                    <td class="productinfo-list text-right">10</td>
                    <td class="productinfo-list text-right">110.00</td>
                    <td class="productinfo-list text-right">90.23</td>
                    <td class="productinfo-list text-right">902.30</td>
                </tr>
                <?php } ?>
                <tr>
                    <td colspan="4" rowspan="4" class="productinfo-list line-height-21">
                        <span>Buyer's VAT: 1234566</span><br />
                        <span>Seller's VAT: 326541233</span><br />
                        <span>Account Number: 12354647</span><br />
                        <span>IFSC Code: BFGH1234</span>
                    </td>
                    <td colspan="3" class="productinfo-list">Gross Total</td>
                    <td class="productinfo-list text-right">6100.23</td>
                </tr>

                <tr>
                    <td colspan="3" class="productinfo-list">Scheme Discount</td>
                    <td class="productinfo-list text-right">100.23</td>
                </tr>
                <tr>
                    <td colspan="3" class="productinfo-list">VAT</td>
                    <td class="productinfo-list text-right">531.10</td>
                </tr>
                <tr>
                    <td colspan="3" class="productinfo-list">Net Total</td>
                    <td class="productinfo-list text-right">6500.10</td>
                </tr>
            </table>
            <pagebreak />
            <br /><br />                
        </td>
    </tr>
</table>
php codeigniter mpdf
2个回答
1
投票

它是如何看,如果你只输出“清单”表格:

<table width="100%" cellpadding="0" cellspacing="0" class="product-list-table">

运行与测试($ I = 0; $ I <99; $ I ++),并告诉我,如果问题是相同的。贝斯特的问候,DD


0
投票

TCPDF与您的HTML表格的问题。你必须简化你的代码。尝试这样的HTML:

<table width="100%" cellpadding="0" cellspacing="0">
<tr>
    <td width="8%" class="left-stripes"></td>

    <td width="92%" class="right-invoice">
        <table width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td width="50%" class="billed-to-info">
                    Billed To,
                    <h3>Party Name</h3>
                    Party Detailed Address <br>
                    0124-234564 <br>
                </td>
                <td width="50%" align="right"><img src="<?php echo base_url(); ?>assets/img/tophead.jpg" class="topHeaderImageRight" /></td>
            </tr>
            <tr>
                <td class="order-info" valign="top" style="padding-top: 20px;padding-left:10px;">
                    Order ID: #602 <br />
                    Delivery Date: 25 April 2016
                </td>
                <td class="billed-to-info" style="padding-top: 20px;">
                    <span>Billed By,</span>
                    <h3>Party Name</h3>
                    Party Address Details <br>
                    0712-277 4770 <br>
                </td>
            </tr>
        </table>
    </td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" class="product-list-table">
<tr style="background-color: #F5F5F5 !important;">
    <th width="8%" class="productinfo-header"></th>
    <th class="productinfo-header text-center"></th>
    <th class="productinfo-header text-left">Item</th>
    <th class="productinfo-header text-center">Mfg. Date</th>
    <th class="productinfo-header text-center">Expiry Date</th>
    <th class="productinfo-header text-right">QTY</th>
    <th class="productinfo-header text-right">MRP</th>
    <th class="productinfo-header text-right">Rate</th>
    <th class="productinfo-header text-right">Total</th>
</tr>
<?php for ($i=0; $i < 22; $i++) { ?>
<tr>
    <td width="8%" class="productinfo-list text-center"></td>
    <td width="5%" class="productinfo-list text-center">1</td>
    <td width="28%" class="productinfo-list text-left">Haldi Powder (100 gm)</td>
    <td width="15%" class="productinfo-list text-center line-height-21">
        01 Feb 16 (10) <br />
        01 Mar 16 (30)
    </td>
    <td width="15%" class="productinfo-list text-center line-height-21">
        01 Oct 16(10) <br />
        01 Nov 16(30)
    </td>
    <td width="8%" class="productinfo-list text-right">40</td>
    <td width="8%" class="productinfo-list text-right">60.00</td>
    <td width="8%" class="productinfo-list text-right">55.23</td>
    <td width="13%" class="productinfo-list text-right">5246.00</td>
</tr>

<tr>
    <td width="8%" class="productinfo-list"></td>
    <td class="productinfo-list text-center">12</td>
    <td class="productinfo-list text-left">Haldi Powder (200 gm)</td>
    <td class="productinfo-list text-center">01 Feb 16</td>
    <td class="productinfo-list text-center">01 Oct 16</td>
    <td class="productinfo-list text-right">10</td>
    <td class="productinfo-list text-right">110.00</td>
    <td class="productinfo-list text-right">90.23</td>
    <td class="productinfo-list text-right">902.30</td>
</tr>
<?php } ?>
<tr><td>&nbsp;</td></tr>

<tr>
    <td width="8%" class="productinfo-list"></td>
    <td colspan="4" rowspan="4" class="productinfo-list line-height-21">
        <span>Buyer's VAT: 1234566</span><br />
        <span>Seller's VAT: 326541233</span><br />
        <span>Account Number: 12354647</span><br />
        <span>IFSC Code: BFGH1234</span>
    </td>
    <td colspan="3" class="productinfo-list">Gross Total</td>
    <td class="productinfo-list text-right">6100.23</td>
</tr>

<tr>
    <td width="8%" class="productinfo-list"></td>
    <td colspan="3" class="productinfo-list">Scheme Discount</td>
    <td class="productinfo-list text-right">100.23</td>
</tr>
<tr>
    <td width="8%" class="productinfo-list"></td>
    <td colspan="3" class="productinfo-list">VAT</td>
    <td class="productinfo-list text-right">531.10</td>
</tr>
<tr>
    <td width="8%" class="productinfo-list"></td>
    <td colspan="3" class="productinfo-list">Net Total</td>
    <td class="productinfo-list text-right">6500.10</td>
</tr>
</table>

这应该解决您的问题。

最好的祝福,

戴夫

© www.soinside.com 2019 - 2024. All rights reserved.