dompdf页面中断无法工作


dompdf page breakes not working

这是的样本图像

    <!DOCTYPE html>
<html class="bg-black">
<head>
    <meta charset="UTF-8">
    <title><?php if(isset($title)) echo $title.' | '; ?>  Sales agent management software (SAMS) </title>
    <style>
        body{
            font-size: 9px;
            margin: 20px;
        }
        th,td,p,div,table,h3{margin:0;padding:0}
        @page { margin: 20px; }
        .header{
            border-bottom: 1px solid #dddddd;
            text-align: center;
            position: fixed; top: 0;
        }
        .footer { position: fixed; bottom: 0px; text-align: center }
        .pagenum:before { content: counter(page); }
    </style>
</head>
<body>
<div class="header">
    <h2><?php echo get_option('company_name'); ?> Catalog</h2>
</div>
<br /><br />
<div class="footer">Page: <span class="pagenum"></span>, creation time : <?php echo date('l jS 'of F Y h:i:s A') ?>, create by: <?php echo user_full_name(singleDbTableRow(loggedInUserData()['user_id'])); ?></div>
<br />
<div class="box-body">
    <?php
    $usd = get_option('lkr_per_usd', 134);
    ?>

    <?php
    $result = array_chunk($products->result_array(), 3);
    foreach($result as $products){  ?>
        <table style="width:100% style="page-break-after:always;"   >
        <tr>
        <?php 
        foreach($products as $productArray){
            $product = (object) $productArray;
            echo '<td>';
        ?>
        <div style="width: 100%; height: 210px;  border: 1px solid #dddddd; margin: 10px; padding: 5px;">
                <div class="box-header">
                    <p class="box-title"><FONT SIZE=12><?php echo $product->product_name; ?></FONT></p>
                </div>
                <div style="height: 80px; text-align: center;">
                    <?php echo '<img src="'.'uploads/'. $product->photo.'" class="img-responsive" style="height:80px !important; width: 150px !important"  />'; ?>
                </div>
                <div style="clear: both"></div>
                <table class="table table-responsive">
                    <tr>
                        <th><FONT SIZE=12>ID</FONT></th>
                        <td><FONT SIZE=14><?php echo $product->product_id; ?></FONT></td>
                    </tr>
                    <tr>
                        <th><FONT SIZE=12>LKR</FONT></th>
                        <td><FONT SIZE=14><?php $lkr = get_selling_price($product);
                            echo  number_format(round($lkr, get_option('round_precision')) ); ?></FONT>
                        </td>
                    </tr>
                    <tr>
                        <th> <FONT SIZE=12>US $</FONT></th>
                        <td><FONT SIZE=14><?php echo number_format(round(lkr_to_usd($lkr), get_option('round_precision')) ); ?></FONT></td>
                    </tr>
                </table>
        </div>
            </td>
        <?php } ?>
    </tr>
    <?php } ?>
    </table>
</div><!-- /.box-body -->

</body>
</body>
</html>

当我尝试生成pdf时,它总是这样。我在上面添加了我的生成pdf代码。第2页不像第1页。。我搜索并找到了其他人问题的dompdf解决方案。但我的问题是在第二页,它不是第一页。

在dompdf方面存在一些错误行为。由于某些原因,当对表行进行分页时,使用width: 100%对包含产品信息的DIV进行样式设置会破坏布局。如果从DIV中删除该样式,那么文档应该按预期呈现。默认的DIV布局是全宽的,因此您可以将宽度样式保留在DIV out 上