2015-04-07 23 views
2

我有一個非常簡單的頁面,顯示了多個部分。每個部分都有一個標題,然後是一些子彈。我想這樣做,以便如果整個部分不適合在頁面上,然後移動到下一頁。DOMPDF - 無法讓頁面打破內部工作

要做到這一點我已經包裹在像這樣一個div元素每節..

<div style='page-break-inside:avoid; break-inside: avoid; -webkit-column-break-inside: avoid;'> 

,我得到的是,子彈不破壞內(這是好的),結果不過節頭做不要留在子彈(這是不好的)。

任何可以提供的幫助將非常感激。

這裏是我使用的PHP代碼:

$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:

<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> 

最後,我已經包括所產生的分頁符的屏幕截圖。 ..

Page Break Screen Shot

回答

1

在V0.6.1這似乎是有點錯誤行爲的r喜歡這個功能。因爲你沒有將你的文本包含在塊級元素中,所以dompdf似乎無法跟蹤它到達下一頁的流程(對此問題的第一次猜測)。修復似乎是將該文本包裝在塊級元素中。

您所提供的代碼示例似乎並不適合於固定問題,但你想嘗試瞄準是一樣的東西:

<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>