DOMPDF,Table 行高在第二页恢复正常
DOMPDF, Table row height back to normal in second page
我有这个 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,但是之后,他们 return 达到正常高度。
这是怎么回事,我该如何解决这个问题?
嗯,真奇怪。尝试其中一种解决方案怎么样?
<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>
我很想知道结果。
我有这个 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,但是之后,他们 return 达到正常高度。
这是怎么回事,我该如何解决这个问题?
嗯,真奇怪。尝试其中一种解决方案怎么样?
<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>
我很想知道结果。