douliang1891 2019-07-25 19:13
浏览 446

如何防止TCPDF中的分页符

I have a block of text like this:

<h2> This is heading</h2>

<p> This is a paragraph</p>

The page is breaking after the h2, and I want it to stick together with the following paragraph.

I have tried wrapping both elements in a html element (div, span), applying a class to them, and put this CSS in style tags at the beginning of the html to be printed in TCPDF:

page-break-inside:avoid

But it still breaks the page.

Other settings I have which may be relevant:

$pdf->SetAutoPageBreak(TRUE, 35);

  • 写回答

1条回答 默认 最新

  • dongqishun6409 2019-07-25 20:19
    关注

    Try this..

    <p class="inline-object"><h2 class="inline-object">This is heading</h2> This is a paragraph</p>
    

    Add CSS:

    .inline-object{display:inline}

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器