Nor*_*hys 3 html css printing export-to-pdf mpdf
如何告诉 mpdf 将 div 内容移动到下一页而不是在中间中断它?我发现了一些 mpdf 特定的标签,但它对我没有帮助。有任何想法吗?
<div> <!-- content inside div should not be broken -->
<h1>Heading</h1>
<ul>
<li n:foreach="$teacherSummary as $teacher => $children">
{$teacher}: {array_unique($children)|implode:', '}
</li>
</ul>
<p><strong>{$event->note}</strong></p>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS 属性也page-break-inside适用于 mpdf。
用法:
<div style="page-break-inside:avoid !important;">
<h1>Heading</h1>
<ul>
<li n:foreach="$teacherSummary as $teacher => $children">
{$teacher}: {array_unique($children)|implode:', '}
</li>
</ul>
<p><strong>{$event->note}</strong></p>
</div>
Run Code Online (Sandbox Code Playgroud)