How to remove extra borders in continues pages of HTML table in mpdf?

509 Views Asked by At
<div id="page-details">
    <table style="page-break-inside: avoid !important;" width="1280px" cellspacing="0" cellpadding="0">
        <tr style="page-break-inside: avoid !important; ">
            <td width="1280px">
                <table autosize="1" cellspacing="0" cellpadding="0" width="1280px">
                    <tr>
                        <td style="border-right:1px solid; height:25px; text-align:center;" width="40px">No</td>
                        <td width="320px" style="border-right:1px solid; text-align:center; height:25px;">Typology</td>
                        <td width="415px" style="border-right:1px solid; text-align:center; height:25px;">Description of Goods</td>
                        <td width="100px" style="border-right:1px solid; text-align:center; height:25px;">Width</td>
                        <td width="100px" style="border-right:1px solid; text-align:center; height:25px;">Height</td>
                        <td width="80px" style="border-right:1px solid; text-align:center; height:25px;">Qty</td>
                        <td width="100px" style="border-right:1px solid; text-align:center; height:40px;">Sq Feet
                        </td>
                        <td width="125px" style="text-align:center; height:40px;">Total
                        </td>
                    </tr>
                </table>
            </td>
        </tr>

        <!-- for loop start -->

        <?php
            if($quotation->items != null && count($quotation->items) > 0) {
                $index = 1;
                for ($i=0; $i < count($quotation->items); $i++) {
        ?>
                <tr style="page-break-inside: avoid !important;">
                    <td width="1280px">
                        <table cellspacing="0" cellpadding="0" width="1280px" style="overflow-wrap: break-word; page-break-inside: avoid !important; ">
                            <tr>
                                <td style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; height:75px; text-align:center;" width="40px">
                                    <?php echo $index++; ?>
                                </td>

                                <td width="320px" style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; height:275px;">
                                    <?php
                                        if ($quotation->items[$i]->seriesType == 7 || 
                                            $quotation->items[$i]->seriesType == 8) {
                                    ?>
                                    <img src="<?php echo $quotation->items[$i]->url;?>" style="max-height: 320px; max-width: 275px; padding: 5px;">
                                    <?php
                                        } else {
                                    ?>
                                    <img src="<?php echo $quotation->items[$i]->url;?>" style="max-height: 320px; max-width: 275px; padding: 5px;">
                                    <?php
                                        }
                                    ?>
                                </td>

                                <td width="415px" style="word-wrap: break-word; border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; overflow-wrap: break-word; padding: 5px;">
                                    <?php
                                        echo "Pattern: <b>" . $quotation->items[$i]->patternName . "</b>";
                                    ?>
                                    <br>
                                    <p style="font-size: 20px;">
                                    <?php
                                        echo "Series: <b>" . $quotation->items[$i]->seriesName . "</b>";
                                    ?>
                                    <br>
                                    <?php
                                        echo "Section Company: <b>" . $quotation->items[$i]->companyName . "</b>";
                                    ?>
                                    <br>
                                    <?php
                                        echo "Glass: <b>" . $quotation->items[$i]->type . "</b>";
                                    ?>
                                    <br>
                                    <?php
                                        echo "Color: <b>" . $quotation->items[$i]->colorType . "</b>";
                                    ?>
                                    </p>
                                    <br>
                                    
                                    <?php
                                    if (isset($quotation->items[$i]->location)) {    
                                    ?>
                                        <p style="font-size: 20px; font-weight: bold;">
                                        <?php
                                            echo "Location: " . $quotation->items[$i]->location;
                                        ?>
                                        </p>
                                    <?php
                                    }
                                    ?>

                                    <br>

                                    <p style="font-size: 20px;">
                                    <?php
                                        if ($quotation->items[$i]->lockId > 0) {
                                            echo "Lock - <b>" . $quotation->items[$i]->lockName . "</b>";
                                    ?>
                                    </p>
                                    <?php
                                        }
                                    ?>
                                    
                                    <?php
                                        if (!empty($quotation->items[$i]->lockDescription)) {
                                    ?>
                                    <p style="font-size: 20px; margin-left: 20px;">
                                    <?php
                                            echo "Description - <b>" . $quotation->items[$i]->lockDescription . "</b>";
                                    ?>
                                        </p>
                                    <?php
                                        }
                                    ?>

                                    <?php
                                       if (!empty($quotation->items[$i]->make)) {
                                    ?>
                                    <p style="font-size: 20px; margin-left: 20px;">
                                    <?php
                                            echo "Make - <b>" . $quotation->items[$i]->make . "</b>";
                                    ?>
                                        </p>
                                    <?php
                                        }
                                    ?>
                                    
                                    
                                    
                                    <?php
                                        if (!empty($quotation->items[$i]->model)) {
                                    ?>
                                    <p style="font-size: 20px; margin-left: 20px;">
                                    <?php
                                            echo "Model - <b>" . $quotation->items[$i]->model . "</b>";
                                    ?>
                                        </p>
                                    <?php
                                        }
                                    ?>
                                    
                                    
                                    <?php
                                        if (!empty($quotation->items[$i]->brand)) {
                                    ?>
                                    <p style="font-size: 20px; margin-left: 20px;">
                                    <?php
                                            echo "Brand - <b>" . $quotation->items[$i]->brand . "</b>";
                                    ?>
                                        </p>
                                        <br>
                                    <?php
                                        }
                                    ?>
                                </td>

                                <td width="100px" style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; text-align:center; height:75px;">
                                    <?php echo number_format($quotation->items[$i]->totalWidth, 2); ?>
                                </td>
                                
                                <td width="100px" style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; text-align:center; height:75px;">
                                    <?php echo number_format($quotation->items[$i]->totalHeight, 2); ?>
                                    
                                </td>
                                
                                <td width="80px" style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; text-align:center; height:75px;">
                                    <?php echo $quotation->items[$i]->qty; ?>
                                </td>
                                
                                <td width="100px" style="border-top:1px solid; border-right:1px solid; border-bottom: 1px solid; text-align:center; height:75px;">
                                    <?php
                                        $totalSqFeet = $quotation->items[$i]->totalFoot * $quotation->items[$i]->qty;
                                        echo number_format($totalSqFeet, 2); 
                                    ?>
                                </td>
                                
                                <td width="125px" style="border-top:1px solid;  border-bottom: 1px solid;text-align:center; height:75px;">
                                    <?php echo number_format($quotation->items[$i]->total, 2); ?>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
        <?php
                }
            }
        ?>

        <!-- for loop end -->
    </table>
</div>

Following is the Image of the issue I am facing in PDF for the reference. Border Issue

I have placed page-break-inside: avoid !important; code inside table and tr both.

Also set $mpdf->shrink_tables_to_fit = 1; in MPDF object but still I am getting extra borders.

0

There are 0 best solutions below