2
votes

I'm working with DomPdf and trying to convert my file into pdf but facing a strange error given below

I googled many times and read different forums but didn't get the reason for this error.

Please help me guys.

Fatal error: Uncaught Error: Call to a member function get_cellmap() on null in C:\xampp\htdocs\dom\dompdf\src\FrameReflower\TableCell.php:37 Stack trace: #0 C:\xampp\htdocs\dom\dompdf\src\FrameDecorator\AbstractFrameDecorator.php(893): Dompdf\FrameReflower\TableCell->reflow(NULL) #1 C:\xampp\htdocs\dom\dompdf\src\FrameReflower\TableRow.php(52): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow() #2 C:\xampp\htdocs\dom\dompdf\src\FrameDecorator\AbstractFrameDecorator.php(893): Dompdf\FrameReflower\TableRow->reflow(NULL) #3

Code

require_once './dompdf/autoload.inc.php';
use Dompdf\Dompdf;

$dompdf = new Dompdf();
$dompdf->loadHtml(file_get_contents('./my-file.php'));

$dompdf->setPaper('A4','landscape');
$dompdf->render();

$dompdf->stream('codexworld',array('Attachment'=>0));

my-file.php

<!DOCTYPE html>
<html>

<head>
</head>

<body>

<div id="page-wrap">
<form method="post" action="save_view.php" novalidate="">   

<div id="header">

<h2 class="title" style="text-decoration: underline;font-size:2em;font-family: Brush Script Mt;">Pro Tech Diagnostics</h2>
<!--            <img id="image"  width="auto" src="images/Logo.png" alt="logo" height="60"/>-->
<div  class="adjust_contact">
<p>26893 Bouquet Canyon Rd. Suite C204 Saugus, CA 91350</p>
<div class="parent">

<p class="left">Phone # (818)644-1965</p>
<p class="right">Fax # (661) 468-7504</p>
</div>
</div>
</div>

<div id="identity">



<div id="header1">

<h3>Customer Info</h3>
</div>

</div>


<div style="clear:both"></div>


<!--            <textarea id="customer-title">Widget Corp.
c/o Steve Widget</textarea>-->

<div id="customer"> 
<div id="parent">

<table id="meta" style="overflow: wrap" class="left1">

<tr>
<td class="meta-head">Name</td>
<td>
<input name="name" type="text"/>

</td>
</tr>

<tr>
<td class="meta-head">Address</td>
<td>
<input name="address" type="text"/>

</td>
</tr>
<tr>
<td class="meta-head">Phone</td>
<td>
<input  required="required" name="phone" type="text"/>

</td>
</tr>                


</table>



<table id="meta" style="overflow: wrap" class="right1">


<tr>
<td class="meta-head">Invoice#</td>
<td>
<input  required="required" name="invoice" type="text"/>

</td>
</tr>                

<tr>

<td class="meta-head">Paid Date</td>
<td>
<input  required="required" name="date" type="text"/>
</td>
</tr>


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


<!-----------------------3 columns Table Section------------------------->

<div id="identity">
<div id="header1-1">

<h3>Vehicle Info</h3>
</div>

</div>

<div class="Row">
<div class="Column">
<table id="meta" style="overflow: wrap" class="left1">

<span class="parent">
<tr>
<td class="meta-head">Make:</td>
<td>
<input  required="required" name="make" type="text"/>

</td>
</tr>

<tr>
<td class="meta-head">Model:</td>
<td>
<input  required="required" name="model" type="text"/>

</td>
</tr>
</span>
<tr>
<td class="meta-head">Year:</td>
<td>
<input  required="required" name="year" type="text"/>

</td>
</tr>                


</table>    

</div><!--1st table-->


<div class="Column">
<table id="meta" style="overflow: wrap" class="left1">

<span class="parent">
<tr>
<td class="meta-head">Vin #:</td>
<td>
<input  required="required" name="vin" type="text"/>

</td>
</tr>

<tr>
<td class="meta-head">Lic.#:</td>
<td>
<input  required="required" name="lic" type="text"/>

</td>
</tr>
</span>
<tr>
<td class="meta-head">Miles:</td>
<td>
<input  required="required" name="miles" type="text"/>

</td>
</tr>                


</table>
</div><!--2nd table-->

<div class="Column">

<table id="meta" style="overflow: wrap" class="left1">

<span class="parent">
<tr>
<td class="meta-head">Color:</td>
<td>
<input  required="required" name="color" type="text"/>

</td>
</tr>

<tr>
<td class="meta-head">R.O. #:</td>
<td>
<input  required="required" name="ro" type="text"/>

</td>
</tr>
</span>
<tr>
<td class="meta-head">P.O. #:</td>
<td>
<input  required="required" name="po" type="text"/>

</td>
</tr>                


</table>
</div><!--3rd table-->

</div><!--End 3 column table row-->






<table id="items" style="overflow: wrap; margin-top: 100px;">

<tr>
<th  colspan="6">Descryption</th>

<th>Hrs</th>
<th colspan="1">Amount</th>
</tr>

<tr class="item-row">
<td colspan="6" class="item-name">
<textarea style="padding-bottom: 300px;" name="description" rows="12" cols="5"></textarea>
<p style="font-weight: bold">*******All Parts Supplied By Shop*******</p>
</td>


<td>
<input  name="hrs" type="text"/>

</td>

<td colspan="5">

<input required="required" name="amount" type="text"/>
</td>
</tr>


<tr>
<td colspan="4">Technician #: 81 (Miguel A.)</td>
<td style="border: none;" colspan="2">Labor Hrs:</td>
<td colspan="1"><input placeholder="0"  name="labourHrs" type="text"/></td>
<td colspan="1"></td>
</tr>

<tr>
<td colspan="2">Labor Rate (Per Hr):</td>
<td  colspan="2"><input placeholder="60" required="required" name="labourRate" type="text"/></td>
<td style="border: none;" colspan="2">Labor Price:</td>
<td colspan="1"><input placeholder="0"  name="labourPrice" type="text"/></td>
<td colspan="1"></td>
</tr>

<tr>
<td style="border: none;" colspan="4"></td>
<td style="border: none;" colspan="2">Total</td>
<td colspan="1"></td>
<td colspan="1"><input  placeholder="0"  name="total" type="text"/></td>
</tr>

<tr>
<td style="border: none" colspan="4"></td>
<td colspan="3">Grand Total</td>
<td colspan="1"><input  placeholder="$0.00"  name="gTotal" type="text"/></td>
</tr>


<tr>
<td colspan="4">Signature Approval:</td>
<td colspan="4"></td>
</tr>

<tr>
<td style="border: none" colspan="4"></td>
<td style="border-right: none;" colspan="4">Paid</td>
</tr>

<tr class="no-border">
<td colspan="4"></td>
<td></td> 
<td >Yes<input type="checkbox" name="one" value="Yes( &#10003; )"></td>
<td>No ( )<input type="checkbox" name="two" value="No( &#10003; )"></td>
<td>P.O. ( )<input type="checkbox" name="three" value="P.O( &#10003; )"></td>
</tr>

<tr>

<td colspan="8">
<p style="font-size: 10px">Not responsible for loss by fire or theft or any other cause beyond our control. I hereby authorize the above repair work to be done with the necessary material & grant
permission to operate equipment for purpose of testing and inspection. An express mechanic's lien is acknowledged to secure the amount of repairs. I agree to pay
the payment in full no later than 30 days after work has been completed. After 30 days, a 1.4% monthly charge will be added to the outstanding balance.
</p>
</td>
</tr>


</table>


</div>
<h2 style="text-decoration: underline;font-style: italic;text-align: center; font-weight: bold;font-family: Brush Script Mt;">
Thanks for Your Business
</h2>
<input name="submit" class="submit" type="submit" value="Submit"/>

</form>

</body>

</html>
5
googling for Call to a member function get_cellmap() on null github.com/dompdf/dompdf/issues/691 or github.com/barryvdh/laravel-dompdf/issues/248 - dparoli
@dparoli I have already tried your suggested solutions but my issue is still there. - shani jani

5 Answers

3
votes

If you are using table and you are facing this problem then There are two tricks which work for me. I don't know if this trick is correct solutions or not.

  1. Check Number of td should be same in all tr inside your table.
  2. If you have used tfooter then remove that tfooter and place that tr inside tbody.

It might help you.

1
votes

DomPDF Make Conflict with CSS properties Like Display I don't Know why But Try to remove Display

1
votes

I thought that was table-bordered, a CSS issue, but was HTML, I had thead and tr tags, I removed thead tag: before:

<thead>
<tr>
...
</tr>
</thead>
...

after:

<tr>
...
</tr>

Worked for me. I didn't find out, because with little data (10) worked fine but with more data (15-20) it returned this error

0
votes

I found this issue caused by CSS (I had padding in mm)

-1
votes

I also had this issue and when I removed all responsive part or css from the table tag then it's work properly. So remove this part style="overflow: wrap" from your Table tag.