0

I have the following test code, which demonstrates that when a table row is too large it jumps to the next page:

<?php

require __DIR__.'/vendor/autoload.php';
header('Content-type: application/pdf');

use Spipu\Html2Pdf\Html2Pdf;

$text = str_pad("", 6000, "Lorem ipsum ");

$html2pdf = new Html2Pdf();
$html2pdf->writeHTML('<style>.header { height: 500px; }</style><div class="header">Title</div><table style="width: 300px;"><tr><td>'.$text.'</td></tr></table>');
$html2pdf->output();

I want the table row to continue until the end of the first page and then go to the second page, so there is no gap in the pdf.

To install:

mkdir test
cd test
composer init
composer require spipu/html2pdf
[Copy code above to index.php]
php -S localhost:1234 index.php
Stefan
  • 21
  • 6

0 Answers0