Lacrifilm Lacrifilm - 1 month ago 19
CSS Question

DOMPDF, Table row height back to normal in second page

I have this HTML code that I will use to add in my

.pdf
file:

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


Below is the code that I use to generate my
.pdf
file:

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();


This code has one problem... my row have 300px of height, when I open my pdf file, in the first page the height is normal (has 300px) in the second page the first row have 300px, but after that, they return to normal height.

What is happening, and how I can solve this problem?

Answer

Hmm, that is odd. What about trying one of these solutions?

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

or

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

I'm interested in hearing the results.