我在使用DOMPDF和Laravel有问题。我使用DOMPDF在文档之后将刀片视图呈现为PDF格式,但是当我有超过一页的记录时,它会切断它们。就像将overflow:hidden添加到页面中一样,这样记录就不会显示出来。你可以从下面的图片中看到。你可以清楚地看到底部还有另一条记录,但下一页是资历,而不是列表中的下一条记录。
我试过用分页和各种方式来尝试这个工作,但是对于我的生活来说,这只是不想打球。
我在他们的文档中找不到任何表明这是一个问题的东西,我也不知道是什么原因造成的。
使用的软件包:barryvdh/laravel-dompdf
呈现的PDF:

正在加载的视图的部分:
请原谅表,但由于PDF不加载CSS3,我必须回到基础,以获得适当的样式结果所需的PDF格式。
<tr>
<td class="border-b-4 border-grey-200 pb-5 mb-5">
<table width="100%" class="mb-5" style="width:100%" border="0" cellpadding="0">
<tr>
<td>
<h1 class="text-6 text-grey-700 mb-3">Employment History</h1>
</td>
</tr>
</table>
@foreach ($employers as $employer)
<table width="100%" class="mb-5" style="width:100%" border="0" cellpadding="0">
<tr>
<td class="border border-grey-200 p-5 rounded">
<h2 class="capitalize text-grey-700 text-lg">{{ $employer->job_title }}</h2>
<span class="text-grey-600">{{ $employer->employer_name }}</span>
<p class="my-3 text-blue-500 text-sm">
<span>{{ date('jS F Y', strtotime($employer->from_date)) }}</span>
<span> — </span>
@if ($employer->current != 1)
<span>{{ date('jS F Y', strtotime($employer->to_date)) }}</span>
@else
<span>Present</span>
@endif
</p>
<div class="markdown text-grey-700">{!! $employer->description !!}</div>
</td>
</tr>
</table>
@endforeach
</td>
</tr>PDF控制器:
PDF::setOptions([
'dpi' => 150,
'defaultFont' => 'sans-serif',
'fontHeightRatio' => 1,
'isPhpEnabled' => true,
]);
$pdf = PDF::loadView('pdf_cv', [
'cv' => $cv,
'awards' => $awards,
'employers' => $employers,
'hobbies' => $hobbies,
'images' => $images,
'languages' => $languages,
'projects' => $projects,
'qualifications' => $qualifications,
'skills' => $skills
]);
return $pdf->stream();我已经做过谷歌搜索,无数次阅读他们的文档,我对这个问题感到困惑,因此,希望其他人也经历过这种经历,并能伸出援手。
如果你需要更多的信息,我可以提供。
发布于 2020-03-14 21:56:56
这方面的问题是表的设置。我不知道到底发生了什么,因为你不能检查PDF,但是表似乎一直重叠,导致它离开页面。
https://stackoverflow.com/questions/60682509
复制相似问题