I am using HTML2PDF converter in PHP to generate PDF.
My html seems to be big so that it could not fit in single page.
I am getting following error when I tried to generate pdf..
'the contents of a TD tag does not fit on a single page'
could not find proper solution yet. Any idea please.
This is my code at end to generate pdf.
require_once("../html2pdf_new/html2pdf.class.php");
try
{
$html2pdf = new HTML2PDF('P','A4','fr');
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->WriteHTML($content);
$html2pdf->Output('exemple.pdf');
}
catch(HTML2PDF_exception $e) {
echo $e;
exit;
}
$content
contains all html.
You can set setTestTdInOnePage
as false to overcome this error.
$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf->setTestTdInOnePage(false);
If this problem still exists: I fixed it with the method
HTML2PDF::setTestTdInOnePage(false)
This setting of value works. In the html2pdf main class file we have a method setTestTdInOnePage which does the rendering of td within a single page if set to true. As it is always true we have this exception thrown as our td data exceeds more than one page. So to avoid it we can set it to false to pass the check.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With