php – DOMPDF: Frame not found in cellmap. O que ocasiona esse erro?

Question:

This problem has been haunting me for a long time and I still haven't found a solution to it.

I developed a system, where in a certain location, the user can print a report, which is generated by the DOMPDF class, in Laravel 4 .

It seems that when the data would theoretically exceed the size of the PDF (a very large <td> for example, or whatever it is), an exception is thrown.

Exception Details:

Class: Cellmap

File: vendor/dompdf/dompdf/include/cellmap.cls.php

Line: 224

Code excerpt where the exception is thrown:

function get_spanned_cells(Frame $frame) {
    $key = $frame->get_id();

    if ( !isset($this->_frames[$key]) ) {
      throw new DOMPDF_Exception("Frame not found in cellmap");
    }
}

In the view that is loaded by DOMPDF , are the data I want to display in the PDF, listed in an HTML table.

NOTE : The exception data is not the file I am working on, but the source code of the DOMPDF library.

Answer:

I've already faced this problem, I haven't used DOMPDF for a long time, but in my case the problem was an incompatibility with the table's border-collapse . Apparently in this ticket is that the problem still persists https://github.com/dompdf/dompdf/issues/657 since 2013.

I've also had a problem with elements with very large content as you described, what I did to work around these cases was to force a page break.

To force a break you must use one of the values ​​recognized by DOMPDF , I tried to find some documentation but unfortunately a complete reference of all existing markers has not yet been developed. I know of the following: page-break-inside , page-break-auto , page-break-after but I believe there are more types. An example of how to use it would be like this:

<table>
  <tr style="page-break-after:always;"></tr>
  <tr></tr>
  <!-- ... -->
</table>

Hope this helps.

Scroll to Top