Reputation: 644
I have following html code in my document for generating PDF, but resulted PDF is not generating properly.
<table border="1" class="table table-striped">
<thead>
<th>Sr No.</th>
<th>Particulars </th>
<th>Qty </th>
<th>rate </th>
<th>Amount </th>
</thead>
<tbody>
<br><br>
@foreach($data as $row)
<tr>
<td>{{ $row['temp_invoice_id'] }}</td>
<td>{{ $row['tyre_brand']." ".$row['tyre_model'] }}</td>
<td>{{ $row['quantity'] }}</td>
<td>{{ $row['rate'] }}</td>
<td>{{ $row['total'] }}</td>
</tr>
@endforeach
</tbody>
</table>
But when the PDF is generated it shows something like this I don't know why it's not generating proper PDF can anyone have solution over this problem, or we have to apply separate css
for print media?
Upvotes: 1
Views: 198
Reputation: 36
Inside thead use tr tag it is working fine.
<thead>
<th>Sr No.</th>
<th>Particulars </th>
<th>Qty </th>
<th>rate </th>
<th>Amount </th>
</thead>
use like this,
<thead>
<tr>
<th>Sr No.</th>
<th>Particulars </th>
<th>Qty </th>
<th>rate </th>
<th>Amount </th>
</tr>
</thead>
Upvotes: 1
Reputation: 1129
Remove the <br><br>
snippet in your <tbody>
they are not valid, so the browser might ignore them but maybe the PDF generator (I don't know which one you use) might not.
Also place the <th>
s inside a row (<tr>
)
Upvotes: 0