DOMPDF: Frame not found in cellmap. What causes this error?

Asked

Viewed 1,198 times

5

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

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

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

Details of the exception:

Class : Cellmap

Filing cabinet : vendor/dompdf/dompdf/include/cellmap.cls.php

Row : 224

Excerpt from the code 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 which is carried by DOMPDF, are the data you 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.

  • 1

    It seems to be an old fault since 2009. Have you tried following these footsteps?

2 answers

3


I’ve faced this problem, I haven’t used the DOMPDF but in my case the problem was an incompatibility with the border-collapse table. It seems in this ticket that the problem still persists https://github.com/dompdf/dompdf/issues/657 since 2013.

I have also had problems with elements with very large content as you described, what I did to get around in 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 not yet developed a complete reference of all existing markers. I know 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 that way:

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

I hope I’ve helped.

  • Friend, how did you "force the page break"? I removed the border-collapse and it worked for a while. Now, however, it no longer works!

  • @Wallacemaxters updated the answer.

  • The page-break-after didn’t work in the <td>, but it worked on the elements that were about footers and messages in the PDF that I was generating. Thank you so much for the tip. I broke my head, but it was only insisting on the little that worked. I just hope that the problem does not persist!

  • @Cool wallacemaxters, good luck on your projects. hug

1

In my case it was that one of the tables that was on my page was without tr encapsulating the tds. After fixing this worked correctly :)

before:

    <table class="boxes">
        <th>Necessidade</th>
        <th>Área</th>
        <th>Cursos utilizados como base</th>
      ...
    </table>

Afterward:

<table class="boxes">
   <tr>
    <th>Necessidade</th>
    <th>Área</th>
    <th>Cursos utilizados como base</th>
   </tr>
  ...
</table>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.