如何在MPDF中的HTML表的继续页面中删除额外的边界?
<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>
以下是我在PDF中面临的问题的图像以供参考。
我已经放置了page-break-inside:避免!表中的代码和TR两者。
还设置$ MPDF-&gt; shillink_tables_to_fit = 1;在MPDF对象中,但我仍然会得到额外的边界。
<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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论