首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DOMPDF -无法使分页-内部工作

DOMPDF -无法使分页-内部工作
EN

Stack Overflow用户
提问于 2015-04-08 01:55:31
回答 1查看 1.4K关注 0票数 3

我有一个非常简单的页面,其中显示了许多部分。每个部分都有一个标题,然后是一些项目符号。我想让它这样做,如果整个部分不能放在页面上,那么它就会移动到下一页。

为了实现这一点,我将每个部分包装在一个div元素中,如下所示。

代码语言:javascript
复制
<div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'>

我得到的结果是,子弹没有在里面折断(这是好的),但是节头没有留在子弹里(这是不好的)。

如果能提供任何帮助,我们将不胜感激。

下面是我使用的PHP代码:

代码语言:javascript
复制
$html = "<html><head></head><body>";
$result = mysql_query("SELECT comment from comments");
while ($row = mysql_fetch_array($result)) { 
    $html .= "<div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'>\n";
    $html .= $row['comment'] . "\n";
    $html .= "</div>\n";
}
$html .= "\n</body></html>";

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$output = $dompdf->output();
$dompdf->stream("$filename.pdf");

下面是生成的HTML:

代码语言:javascript
复制
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释 
* <html><head></head><body><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">BID VALIDITY:<br></span><ul><li>This ACME Painting proposal is valid until ------</li></ul><p><br></p></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">ENGINEERING NOTES:</span><br><ul><li>Vessel to be designed to include 100% Radiography of Long &amp; Girth seams per ASME prior to PWHT</li><li>All back gouge / root welds shall undergo MPT (Magnetic Particle Testing)</li><li>All external welds shall undergo MPT after fabrication</li><li>All nozzles subject to 100% ultrasonic inspection, Cat. D joints.<br></li></ul></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">HEALTH &amp; SAFETY:<br></span><ul><li>The goal of this project is to treat safety and welfare of each employee as the number one priority.</li><li>Project target is ZERO recordable injuries.</li></ul><p><br></p></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">OVERTIME RATES FOR EXPEDITED DELIVERY:<br><br>Premium - Time + One Half<br></span><ul><li>Time and one half hour pay shall be for all hours Monday - Friday (Day Shift) when employee exceeds 8.5 hours in one day.<br></li><li>Time and one half hour pay shall be paid for the first two hours beyond 8.5 hours.</li><li>Rate:&nbsp; $60/hr (CDN)</li></ul><p><br></p><p><span style="font-weight: bold;">Premium - Double Time</span><br><ul><li>Double time pay shall be for all hours Monday - Friday (Day Shift) when employee exceeds 10.5 hours in one day.</li><li>Double time pay shall be for all hours Monday - Thursday (Night Shift) when employee exceeds 10 hours in one day.</li><li>Double time pay shall be for all weekend hours Saturday - Sunday (Day Shift).</li><li>Double time pay shall be for all weekend hours Friday - Sunday (Night Shift).<br></li><li>Rate:&nbsp; $100/hr (CDN)</li></ul><br></p></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">DRAWING AND DOCUMENT DELIVERY:<br></span><ul><li>Drawing and Engineering documents to be submitted starting in 2-3 weeks after receipt of order.<br></li><li>Welding and NDE procedures and related shall be submitted 2-3 weeks after receipt of order.<br></li><li>Drawings and Engineering documents shall be returned to HWE 7 working days after submission.</li></ul><p><br></p></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">FABRICATION DELIVERY:<br></span><ul><li>Final fabrication will ship 10-12 weeks after receipt of Major Material and Fully Approved Drawings</li></ul><p><br></p></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">ENGINEERING NOTES:</span><br><ul><li>Vessel to be designed to include 100% Radiography of Long &amp; Girth seams per ASME prior to PWHT</li><li>All back gouge / root welds shall undergo MPT (Magnetic Particle Testing)</li><li>All external welds shall undergo MPT after fabrication</li><li>All nozzles subject to 100% ultrasonic inspection, Cat. D joints.<br></li></ul></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">DELIVERY NOTES:</span><br><ul><li>Material delivery subject to review of Mill lead time and confirmation of delivery at time of order entry at Mill</li><li>ACME Painting Enterprises Limited will not accept responsibility or liquidated damages / contractual impact for delays at Mill or by Origin Material manufacturer</li><li>Fabrication and Delivery subject to review of shop loading at time of order<br></li></ul></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">DRAWING AND DOCUMENT DELIVERY:<br></span><ul><li>Drawing and Engineering documents to be submitted starting in 2-3 weeks after receipt of order.<br></li><li>Welding and NDE procedures and related shall be submitted 2-3 weeks after receipt of order.<br></li><li>Drawings and Engineering documents shall be returned to HWE 7 working days after submission.</li></ul><p><br></p></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">FABRICATION DELIVERY:<br></span><ul><li>Final fabrication will ship 10-12 weeks after receipt of Major Material and Fully Approved Drawings</li></ul><p><br></p></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">ENGINEERING NOTES:</span><br><ul><li>Vessel to be designed to include 100% Radiography of Long &amp; Girth seams per ASME prior to PWHT</li><li>All back gouge / root welds shall undergo MPT (Magnetic Particle Testing)</li><li>All external welds shall undergo MPT after fabrication</li><li>All nozzles subject to 100% ultrasonic inspection, Cat. D joints.<br></li></ul></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">DELIVERY NOTES:</span><br><ul><li>Material delivery subject to review of Mill lead time and confirmation of delivery at time of order entry at Mill</li><li>ACME Painting Enterprises Limited will not accept responsibility or liquidated damages / contractual impact for delays at Mill or by Origin Material manufacturer</li><li>Fabrication and Delivery subject to review of shop loading at time of order<br></li></ul></div><div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'><span style="font-weight: bold;">ENGINEERING NOTES:</span><br><ul><li>Vessel to be designed to include 100% Radiography of Long &amp; Girth seams per ASME prior to PWHT</li><li>All back gouge / root welds shall undergo MPT (Magnetic Particle Testing)</li><li>All external welds shall undergo MPT after fabrication</li><li>All nozzles subject to 100% ultrasonic inspection, Cat. D joints.<br></li></ul></div></body></html>
*/

最后,我提供了一个结果分页符的屏幕截图...

EN

回答 1

Stack Overflow用户

发布于 2015-04-12 10:26:38

在v0.6.1中,这似乎是与该功能相关的一些错误行为。因为您没有将文本封闭在块级元素中,所以dompdf似乎无法跟踪它以转到下一页(这是问题的第一个猜测)。修复方法似乎是将文本包装在块级元素中。

您提供的代码示例似乎不适合修复该问题,但您希望尝试的目标是:

代码语言:javascript
复制
<div class='c2'>
  <p><span class="c1">DRAWING AND DOCUMENT DELIVERY:</span></p>
  <ul>
    <li>Drawing and Engineering documents to be submitted starting in 2-3 weeks after receipt of order.<br></li>
    <li>Welding and NDE procedures and related shall be submitted 2-3 weeks after receipt of order.<br></li>
    <li>Drawings and Engineering documents shall be returned to HWE 7 working days after submission.</li>
  </ul>
  <p><br></p>
</div>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29498010

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档