gpt4 book ai didi

php - DOMPDF,表格行高在第二页恢复正常

转载 作者:行者123 更新时间:2023-11-28 16:00:27 25 4
gpt4 key购买 nike

我有这段 HTML 代码,我将使用它添加到我的 .pdf 文件中:

<style>
table{
width:783px;
height:auto;
table-layout:fixed;
}
</style>
<table>
<tr>
<th style="width:783px; height:300px; border:1px solid black;">Firstname</th>
</tr>
<tr>
<th style="width:783px; height:300px; border:1px solid black;">Firstname</th>
</tr>
<tr>
<th style="width:783px; height:300px; border:1px solid black;">Firstname</th>
</tr>
<tr>
<th style="width:783px; height:300px; border:1px solid black;">Firstname</th>
</tr>
<tr>
<th style="width:783px; height:300px; border:1px solid black;">Firstname</th>
</tr>
<tr>
<th style="width:783px; height:300px; border:1px solid black;">Firstname</th>
</tr>
<tr>
<th style="width:783px; height:300px; border:1px solid black;">Firstname</th>
</tr>
</table>

下面是我用来生成我的 .pdf 文件的代码:

define("DOMPDF_ENABLE_HTML5PARSER", true);
define("DOMPDF_ENABLE_FONTSUBSETTING", true);
define("DOMPDF_UNICODE_ENABLED", true);
define("DOMPDF_DPI", 120);
define("DOMPDF_ENABLE_REMOTE", true);

//Configure the directory where you have the dompdf
require_once "dompdf/autoload.inc.php";
use Dompdf\Dompdf;
//$dompdf = new dompdf();
//$dompdf = new DOMPDF();
$dompdf = new Dompdf();
$dompdf->loadHtml($htmlOut);
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'portrait');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream();

这段代码有一个问题...我的行有 300px 的高度,当我打开我的 pdf 文件时,在第一页中高度是正常的(有 300px)在第二页中第一行有 300px,但在那之后, 他们恢复到正常高度。

这是怎么回事,我该如何解决这个问题?

最佳答案

嗯,这很奇怪。尝试其中一种解决方案怎么样?

<th style="width:783px; height:300px; min-height:300px; border:1px solid black;">Firstname</th>

<th><div style="width:783px; height:300px; min-height:300px; border:1px solid black;">Firstname</div></th>

我很想听听结果。

关于php - DOMPDF,表格行高在第二页恢复正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40243593/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com