问题描述
我在使用 barryvdh/laravel-domPDF 时遇到了错误
我使用的是 Laravel 8.42.1 和 PHP 8.0.3。
<div>
<div class="md:grid md:grid-cols-3 md:gap-6">
<div class="mt-5 md:mt-0 md:col-span-2">
<form action="#" method="POST">
<div class="shadow sm:rounded-md sm:overflow-hidden">
<div class="px-4 py-5 bg-white space-y-6 sm:p-6">
<div class="grid grid-cols-2 gap-2">
<div class="content-evenly">
PRIVATE AND CONFIDENTIAL
</div>
<div class="content-evenly col-span-1 sm:col-span-2 border-solid border-4 border-light-blue-500">
<div class="employee float-right m-10 text-sm font-medium text-gray-700">
@foreach($teams as $team)
<tr>
<th>
{{$team->companyName}}
</th><br>
<th>
{{$team->street}}
</th><br>
<th>
{{$team->compound}}
</th><br>
<th>
{{$team->suburb}}
</th>
</tr>
@endforeach
@foreach($employees as $employee)
</div>
<div class="employee float-left m-10 text-sm font-medium text-gray-700 ">
<tr>
<th>
{{$employee->name}} {{$employee->surname}}
</th><br>
<th>
{{$employee->role}}
</th><br>
<th>
{{$employee->idNumber}}
</th>
<th>
{{$employee->phone}}
</th>
</tr>
@endforeach
</div>
</div>
</div>
</form>
</div>
</div>
</div>
解决方法
我认为问题在于您的 html 结构,dompdf 有一些限制,例如不支持某些标签。 我认为你应该只使用带有 thead,th,tbody,tr 的 table 标签: 如果您想阅读有关限制的更多信息,请访问以下链接: https://github.com/dompdf/dompdf#user-content-limitations-known-issues