skip to Main Content

The following:

Frame not found in cellmap

https://github.com/dompdf/dompdf/issues/657

Is a well know problem on the internet. But I can’t find a solution
for the problem. I’m trying to convert my html template to pdf. When I remove the <table> it’s working. Otherwise it throws an exception.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Example 2</title>
    <link rel="stylesheet" href="/administration/style.css" media="all" />
  </head>
  <body>
    <header class="clearfix">
      <div id="logo">
        <img src="/administration/logo.png">
      </div>
      <div id="company">
        <h2 class="name">Company Name</h2>
        <div>455 Foggy Heights, AZ 85004, US</div>
        <div>(602) 519-0450</div>
        <div><a href="mailto:[email protected]">[email protected]</a></div>
      </div>
      </div>
    </header>
    <main>
      <div id="details" class="clearfix">
        <div id="client">
          <div class="to">INVOICE TO:</div>
          <h2 class="name">John Doe</h2>
          <div class="address">796 Silver Harbour, TX 79273, US</div>
          <div class="email"><a href="mailto:[email protected]">[email protected]</a></div>
        </div>
        <div id="invoice">
          <h1>INVOICE 3-2-1</h1>
          <div class="date">Date of Invoice: 01/06/2014</div>
          <div class="date">Due Date: 30/06/2014</div>
        </div>
      </div>
      <table border="0" cellspacing="0" cellpadding="0">
        <thead>
          <tr>
            <th class="no">#</th>
            <th class="desc">DESCRIPTION</th>
            <th class="unit">UNIT PRICE</th>
            <th class="qty">QUANTITY</th>
            <th class="total">TOTAL</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td class="no">01</td>
            <td class="desc"><h3>Website Design</h3>Creating a recognizable design solution based on the company's existing visual identity</td>
            <td class="unit">$40.00</td>
            <td class="qty">30</td>
            <td class="total">$1,200.00</td>
          </tr>
          <tr>
            <td class="no">02</td>
            <td class="desc"><h3>Website Development</h3>Developing a Content Management System-based Website</td>
            <td class="unit">$40.00</td>
            <td class="qty">80</td>
            <td class="total">$3,200.00</td>
          </tr>
          <tr>
            <td class="no">03</td>
            <td class="desc"><h3>Search Engines Optimization</h3>Optimize the site for search engines (SEO)</td>
            <td class="unit">$40.00</td>
            <td class="qty">20</td>
            <td class="total">$800.00</td>
          </tr>
        </tbody>
        <tfoot>
          <tr>
            <td colspan="1"></td>
            <td colspan="1">SUBTOTAL</td>
            <td>$5,200.00</td>
          </tr>
          <tr>
            <td colspan="1"></td>
            <td colspan="1">TAX 25%</td>
            <td>$1,300.00</td>
          </tr>
          <tr>
            <td colspan="1"></td>
            <td colspan="1">GRAND TOTAL</td>
            <td>$6,500.00</td>
          </tr>
        </tfoot>
      </table>
      <div id="thanks">Thank you!</div>
      <div id="notices">
        <div>NOTICE:</div>
        <div class="notice">A finance charge of 1.5% will be made on unpaid balances after 30 days.</div>
      </div>
    </main>
    <footer>
      Invoice was created on a computer and is valid without the signature and seal.
    </footer>
  </body>
</html>

2

Answers


  1. Chosen as BEST ANSWER

    SOLUTION:

    use this:

    $orientation = 'landscape';
    $customPaper = array(0,0,950,950);
    $this->setPaper($customPaper, $orientation);
    

  2. I had a similar problem, but was able to discover that I had an extra < in one of my text items (the text was entered by a user, so they had an age question that was like Are you < 21 years old. Make sure you escape these (in PHP, use htmlentities).

    This can also happen with invalid html or an extra HTML tag. I looked through your <table> above and ran it through dompdf, but it didn’t throw the error, so perhaps you had an errant < in your code that was not copied to StackOverflow?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search