2016-04-15 7 views
1

Ich verwende mpdf php library, um pdf für meine Rechnung zu generieren. In der Rechnung habe ich Liste des Produktes, das ich mit Tabelle auflistet. Aber wenn meine Produktliste auf pdf vergrößert wird, werden alle Produkte auf einer einzelnen Seite zusammengedrückt. Bitte helfen. Unten ist mein CodeAutomatischer Seitenumbruch während des Inhaltsüberlaufs - mpdf

Dank In fortgeschrittenen.

<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> 

Antwort

1

, wie sieht es aus, wenn Sie nur Ausgabe der "Liste" Tabelle:

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

einen Testlauf mit ($ i = 0; $ i < 99; $ i ++) und sagen Sie mir, wenn Das Problem ist das gleiche. beste Grüße, dd

+0

seine Arbeit, was Sie gesagt haben. Aber was ist das Problem, weil ich vollständigen Code wie oben brauche ..? –

0

TCPDF hat Probleme mit Ihrer HTML-Tabelle. Sie müssen Ihren Code vereinfachen. Versuchen Sie, eine HTML wie folgt aus:

<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> 

Dieses sould lösen Sie Problem. Mit freundlichen Grüßen, Dave