Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Haroon1296's avatar

Min/max width is undefined for table rows

Hi, i am using dompdf package

https://github.com/dompdf/dompdf

all work is good but when i generate pdf its show this error

I generate this pdf through api.

Min/max width is undefined for table rows
// Controller
public function trialPdf($record_date_from, $record_date_to, $level_3)
    {
        $obj = new \stdClass();
        
        $obj->record_date_from =  date('d/m/Y', strtotime($record_date_from));    	
        $obj->record_date_to =  date('d/m/Y', strtotime($record_date_to));
        $obj->level_3 = $level_3;
      

        $data['pdf'] = Report::trial($obj); // this line get all pdf data from my Report Model with HTTML

        $pdf = \PDF::loadView('api-pdf.trial', $data);
        
        return $pdf->stream('invoice.pdf');
    }
// here is pdf Result

"""
<tr><th style="font-size:20px; color:#9a1010;" colspan="6"><u>Assets - Current Assets</u></th></tr><tr><th style="font-size:18px; color:#9a1010;" colspan="6"><i>Cash</i></th></tr><tr transaction_id="1"> ◀
\t\t\t\t\t\t\t\t\t\t\t\t\t<td>1-1-1-1</td>
\t\t\t\t\t\t\t\t\t\t\t\t\t<td><a href="http://localhost/projects/construction-erp-laravel-web/ledger_view/1" style="color:#D82020;">Cash In Hand</a></td>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td><b><div class="my-td-style my-text-align">Rs 0</b></div></td>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=""><b><div class="my-td-style my-text-align">Rs 120</b></div></td>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=""><b><div class="my-td-style my-text-align">Rs 0</b></div></td>
\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td colspan=""><b><div class="my-td-style my-text-align">Rs 120</b></div></td>
\t\t\t\t\t\t\t\t\t\t\t\t</tr><tr><th style="text-align:center; color:#9a1010;" colspan="3"><u><b>Total Of Cash</b></u></th>
\t\t\t\t\t\t\t\t      \t<td><b><div class="my-sum-td-style my-text-align">Rs 120</b></div></td>
\t\t\t\t\t\t\t\t      \t<td><b><div class="my-sum-td-style my-text-align">Rs 0</b></div></td>
\t\t\t\t\t\t\t\t      \t<td><b><div class="my-sum-td-style my-text-align">Rs 120</b></div></td>
\t\t\t\t\t\t\t\t      \t  \t\t\t\t</tr><tr><th style="font-size:20px; color:#9a1010;" colspan="6"><u>Liability - <tr><th style="font-size:20px; color:#9a1010;" colspan="6"><u>Capital - <tr><th style="font-size:20px; color:#9a1010;" colspan="6"><u>Income - <tr><th style="font-size:20px; color:#9a1010;" colspan="6"><u>Expenses - <tr><th style="text-align:center; color:#9a1010;" colspan="2"><u><b>Trial Balance Total</b></u></th> ◀
\t\t\t\t<td><b><div class="my-sum-td-style my-text-align">Rs 0</b></div></td>
\t\t\t\t<td><b><div class="my-sum-td-style my-text-align">Rs 120</b></div></td>
\t\t\t\t<td><b><div class="my-sum-td-style my-text-align">Rs 0</b></div></td>
\t\t\t\t<td><b><div class="my-sum-td-style my-text-align">Rs 120</b></div></td>
\t\t\t\t</tr>
// pdf view
<table style="border: 1px solid; width: 100% !important; border-collapse: collapse;">
                    <thead>
                        <tr>
                            <th class="my-thead-style" style="width: 8%;">Code</th>
                            <th class="my-thead-style" style="width: 52%;">Particulars</th>
                            <th class="my-thead-style" style="width: 10%;">Opening</th>
                            <th class="my-thead-style" style="width: 10%;">Debit</th>
                            <th class="my-thead-style" style="width: 10%;">Credit</th>
                            <th class="my-thead-style" style="width: 10%;">Balance</th>
                        </tr>
                    </thead>
                    
                    <tbody class="trial_body">
                        {!! $pdf['trhtml'] !!}
                    </tbody>
                </table>
0 likes
0 replies

Please or to participate in this conversation.