【发布时间】:2020-10-28 21:28:19
【问题描述】:
我想从 HTML 表格创建 HTML 格式的报告。这是我在 Laravel 中的表。
我尝试用 html2pdf 来做,但它不能正常工作,任何人都可以帮我解决这个问题吗?我希望像 table1.html 这样使用 CSS 和 HTML 表格数据下载表格或将其转换为 PDF。
<div class="col-lg-12" id="Reports">
<div >
<table class="table table-dark" >
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">نام دارایی</th>
<th scope="col">CVSS</th>
<th scope="col">توضیحات</th>
<th scope="col">امتیاز</th>
<th scope="col">تاریخ پیدایش</th>
</tr>
</thead>
<tbody>
@foreach($Reports as $Report)
<tr class="{{\App\Report::CvssColor(json_decode($Report->Data)->score)}}">
<th scope="row"><h6 style="color: white">{{$loop->iteration}}</h6></th>
<td><h6 style="color: white" id="Name">{{$Report->Title}}</h6></td>
<td><h6 style="color: white">{{json_decode($Report->Data)->cve}}</h6></td>
<td><h6 style="color: white">{{json_decode($Report->Data)->summary}}</h6></td>
<td><h6 style="color: white">{{json_decode($Report->Data)->score}}</h6></td>
<td>
<h6 style="color: white">{{\Carbon\Carbon::parse(preg_replace('/\s/','',json_decode($Report->Data)->create_date))->format('Y-m-d')}}</h6>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
【问题讨论】:
标签: javascript php html laravel pdf