简体   繁体   中英

make PDF file with laravel-dompdf

Below image show an error to render a "/th>" tag in red circle and blank space to each /td tag in the each rows when I use "Laravel-dompdf".

I thought it came from rendering problem in end of tag when before finished Carbon calculate.

How can I modify to make clear table?

Laravel version: 5.4, plugin: laravel-dompdf.

在此处输入图片说明

<h3>Fullført Jobber</h3>
<div style="overflow-x: auto;">
    <table class="table table-responsive" id="jobs-table">
        <tr>
            <th>Jobb ID</th>
            <th>Brukernavn</th>
            <th>Kundenavn</th>
            <th>Jobbsted</th>
            <th>Jobbtype</th>
            <th>Note 1</th>
            <th>Time Start</th>
            <th>Time brukt</th>
        </tr>
        @foreach($jobs as $job) 
            @if(!$job->deleted_at == null)
        <tr>
            <td>{!! $job->id !!}</td>
            <td>{!! $job->user_name !!}</td>
            <td>{!! $job->customer_name !!}</td>
            <td>{!! $job->job_place !!}</td>
            <td>{!! $job->job_type !!}</td>
            <td>{!! $job->note_1 !!}</td>
            <td>{!! $job->created_at !!}</td>
            <td>{!! \Carbon\Carbon::parse($job->deleted_at)->diff(\Carbon\Carbon::parse($job->created_at))->format('%H:%I:%S')!!}<td>
        </tr>
            @endif 
        @endforeach
    </table>

You have not close your td tag for last column in following line:

<td>{!! \Carbon\Carbon::parse($job->deleted_at)->diff(\Carbon\Carbon::parse($job->created_at))->format('%H:%I:%S')!!}<td>

So use like this:

<td>{!! \Carbon\Carbon::parse($job->deleted_at)->diff(\Carbon\Carbon::parse($job->created_at))->format('%H:%I:%S')!!}</td>

As you forgot to add / in <td> for last column, it is creating new column which is coming as blank in last of each row.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM