为什么我的代码会出现致命错误:未捕获异常';DOMPDF_异常';带有消息';在单元格映射中找不到框架


Why is my code getting an error of Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'Frame not found in cellmap

当记录很多,需要打印在pdf的第二页时,我遇到了这个错误

致命错误:中未捕获异常"DOMPDF_exception",消息为"在cellmap中找不到帧"C: ''examplep''htdocs''pdf_dompdf''dompdf''include''cellmap.cls.php:244堆栈跟踪:#0C: ''examplep''htdocs''pdf_dompdf''dompdf''include''table_cell_renderer.cls.php(50):Cellmap->get_spanned_cells(对象(Table_Cell_Frame_Decorator))#1C: ''examplep''htdocs''pdf_dompdf''dompdf''include''renderer.cls.php(287):Table_Cell_Renderer->渲染(对象(Table_Cell_Frame_Decorator))#2C: ''examplep''htdocs''pdf_dompdf''dompdf''include''renderer.cls.php(107):渲染器->_render_frame('table-cell',对象(Table_Cell_Frame_Decorator))#3C: ''examplep''htdocs''pdf_dompdf''dompdf''include''renderer.cls.php(190):渲染器->渲染(对象(Table_Cell_Frame_Decorator))#4C: ''examplep''htdocs''pdf_dompdf''dompdf''include''renderer.cls.php(190):渲染器->渲染(对象(Table_Row_Frame_Decorator))#5C: ''examplep''htdocs''pdf_dompdf''dompdf''include''renderer.cls.php(190):渲染器->渲染(对象(Table_Row_Group_Frame_Decorator))#6C: ''examplep''htdocs''pdf_dompdf''dompdf''include''renderer.cls.php(190):渲染器->在中渲染C: ''examplep''htdocs''pdf_dompdf''dompdf''include''cellmap.cls.php,第244行

 <div class="ORMExSum">
    <h1 align="center">ORM Executive Summary Report</h1>
      <table cellpadding="0" cellspacing="0" border="1" width="100%">
      <caption style="text-align:left; padding-bottom: 10px;">Keyword: <?php echo 'Juan dela Cruz, Juan Cruz'; ?></caption>
        <thead class="theader">
          <tr><th colspan="<?php echo 3+$rtweekly; ?>">Weekly Rankings</th></tr>
          <tr>
          <th width="10%">Location</th>
          <th width="40%">Negative Snippet</th>
          <th width="10%">Previous Ranking</th>
          <?php while($rw1<$rtweekly):  ?>
            <th width="8%">
            <?php echo date('M. d', strtotime (mysql_result($tweekly,$rw1,"WeeklyRank"))); $rw1++; ?>
            </th>
          <?php endwhile; ?>
          </tr>
         </thead>
         <tbody> 
          <?php $x='a';while($rw2<$rsummary): $rw3 = 0;?>
          <tr>
          <td rowspan="<?php echo $cnt[$x]+1;$x++;?>">
          <?php echo mysql_result($summary,$rw2,"Location");  ?>
          </td>
          <?php for ($i=0; $i < 2+$rtweekly; $i++): ?>
          <td></td>
          <?php $cnt++; endfor;?>
          </tr>
            <?php while($rw3<$rsnippet): $rw4 = 0;?>
              <?php if(mysql_result($snippet,$rw3,"SummaryID") == mysql_result($summary,$rw2,"LocationID")): ?>
                <tr>
                <td style="font-size:11px;">
                <?php echo mysql_result($snippet,$rw3,"NegativeSnippet"); ?>
                </td>
                <td>
                <?php echo mysql_result($snippet,$rw3,"PreviousRank"); ?>
                </td>
                <?php while($rw4<$rtweekly): $rw5 = 0;?>
                <td>
                <?php while($rw5<$rweekly): ?>
                  <?php if(mysql_result($weekly,$rw5,"SummaryID") ==  mysql_result($summary,$rw2,"LocationID") && mysql_result($weekly,$rw5,"SnipPrevID") == mysql_result($snippet,$rw3,"NSPID") && mysql_result($tweekly,$rw4,"WeeklyRank") == mysql_result($weekly,$rw5,"WeeklyRank")): ?>
                  <?php echo mysql_result($weekly,$rw5,"Rank"); ?>
                  <?php endif;?>
                <?php $rw5++; endwhile; ?>
                </td>
                <?php $rw4++; endwhile; ?>
              <?php endif;?>
              </tr>
            <?php $rw3++; endwhile; ?>
            <?php $rw2++; endwhile; ?>

        </tbody>
      </table>
      </div>

我也遇到了同样的问题。

我已经用X行修复了。。强行分页。

这只是因为pdf试图输出很多行,而他无法跳到下一页。

在您的情况下,尝试放置一个:

 page-break-after: always;

在第一个tr.上

<tbody> 
      <?php $x='a';while($rw2<$rsummary): $rw3 = 0;?>
      <tr style="page-break-after: always;">

或者你可以在X行之后制作一个php来完成这项工作。

我希望这对某人有用。

致问候,

=====编辑=====

此外,删除表上的"边框折叠"。

当表格超出纸张大小时会发生这种情况。
您可以使用自定义纸张大小。它将解决问题。

示例:

$paper_orientation = 'landscape';
$customPaper = array(0,0,950,950);
$dompdf->set_paper($customPaper,$paper_orientation);

我已经面临同样的问题好几天了,在一个有rowspan和colspan但没有边界塌陷的巨大表中:塌陷(存在与该属性相关的已知问题)。

我已经通过将其添加到我的表元素的样式中来解决它:

table
{
   border-collapse:unset;   
}

希望它能有所帮助!

我也遇到了同样的问题。请确保您没有任何外部css或任何其他链接文件。然而,我通过内部css和内联css完全设计PDF文件来修复它。我希望它能解决你的问题。

这可以在多次关闭表时解决。然后表格适合纸张大小,错误就消失了。

相关文章: