【问题标题】:php mPdf page-break-inside: auto not workphp mPdf page-break-inside:自动不起作用
【发布时间】:2016-10-12 20:59:15
【问题描述】:

当我在pdf文件中生成表格时,当tr包含长文本时,分页符,表格的下一个单元格被转移到下一页。我尝试使用样式:

 table, tr, td, th, tbody, thead, tfoot {
     page-break-inside: auto !important;
}

但它不起作用。如何在里面启用分页符?

【问题讨论】:

  • 你想达到什么目的?强制休息还是避免休息?
  • @Finwe,当tr 有长文本时,我需要从tr 禁用page-break-inside: avoid。强行中断。
  • 当前 mPDF 版本不支持此功能。避免是唯一可能的值;
  • 谢谢,非常糟糕((
  • 你试过这样的事情吗? mpdf.github.io/troubleshooting/resizing.html

标签: php pdf mpdf


【解决方案1】:

插入行:

$mpdf->shrink_tables_to_fit = 1;

并使用

page-break-inside: avoid

在表格标签中

【讨论】:

  • 有价值的答案。谢啦。我们可以将page-break-inside 用于tbody,thead,tfoot
【解决方案2】:

你必须使用

table {page-break-inside: avoid;}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-23
    • 2011-12-04
    • 2017-07-09
    • 1970-01-01
    • 1970-01-01
    • 2013-09-22
    • 1970-01-01
    • 2013-12-30
    相关资源
    最近更新 更多