PHP HTML 标记内的 TCPDF 不需要的空白页

PHP TCPDF unwanted blank page inside HTML markup

我尝试使用 writeHTML 方法在 TCPDF 中生成一些文本信息。但是 TCPDF 有时会在 table 结构内自动分页后创建额外的空白页(我使用 table 关联标签来格式化文本位置)。

错误示例截图:

更新:这是简化的代码示例:

<?php
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false); 
$pdf->SetMargins('20', '20', '15');
$pdf->SetAutoPageBreak(true, '25');  
$pdf->SetFont('freeserif', '', 11);  
$pdf->AddPage(); 
$tagvs = array(           
    'p' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 1, 'n' => 1)),
    'ul' => array(0 => array('h' => 0.0001, 'n' => 1), 1 => array('h' => 1, 'n' => 1)),
    'ol' => array(0 => array('h' => 0.0001, 'n' => 1), 1 => array('h' => 1, 'n' => 1)),   
    'div' => array(0 => array('h' => 0.0001, 'n' => 1), 1 => array('h' => 0.0001, 'n' => 1)),
    'hr' => array(0 => array('h' => 0.0001, 'n' => 1), 1 => array('h' => 0.0001, 'n' => 1)),
);
$pdf->setHtmlVSpace($tagvs);
$html = '<p>Some Content</p><table><tbody><tr><td>Some content</td><td>Some content</td></tr>';
//READ NEXT LINE PLEASE
$html .= '<tr><td>BEFORE THIS TR COULD BE BLANK PAGE IN GENERATED PDF</td><td>IT DEPENDS OF TABLE CONTENT LENGTH</td></tr>';
//READ PREVIOUS LINE PLEASE
$html .= '<tr><td>Some content</td><td>Some content</td></tr></tbody></table><p>Some Content</p><p>Some Content</p>';   
$pdf->writeHTML($html, true, false, true, false, ''); 
$pdf->Output('document.pdf', 'I');
?>

更新:更具示范性的屏幕截图: Table cell is going to the end of the page

如何避免?非常感谢!

似乎将 style="page-break-inside: avoid;" 添加到 table 单元格内容的最后一个标签可以解决问题。

<td>
    <span>Some content here</span>
    <p>Another content</p>
    <div>One more content</div>
    <p style="page-break-inside: avoid;">Such tag does the thing!</p>
</td>