I have a problem using barryvdh's DOMPDF plugin for Laravel (5.3), the problem is with pagination in the generated PDF file, for some reason when my data (in a table) is too long the second page never comes up, instead, the content gets stuck at the top of the page.
I don't know what I'm doing wrong, I have used barryvdh's plugin before with Laravel (5.2) and the pagination worked fine.
I have attached two images one with the wrong pagination using Laravel 5.3 and another with the correct pagination from the project using Laravel 5.2
wrong pdf pagination, correct pdf pagination
and this is how I am calling DOMPDF from my controller:
public function note($config_params)
{
$params = explode("-", $config_params); // params['note_id','print_option']
$note = SaleNote::get_ById($params[0]);
$note_detail = SaleNoteItem::get_ByNote($params[0]);
$totals = SaleNoteItem::get_TotalsByNote($params[0]);
$company = Company::get_ById(session('company'));
$pdf = \PDF::loadView('movements.sales.note-pdf', [
'note' => $note,
'note_detail' => $note_detail,
'totals' => $totals,
'company' => $company,
'hide_client' => $params[1]
]);
return $pdf->stream();
}
has anyone faced this issue before? I hope you can help, regards.
For anyone who comes across this issue, it was because of CSS styles and HTML markup in the view.
More explicity, I had a < main >< / main > tag, and inside this tag, it was the table and all the other content, just removing this tag and adding clear: both; in the parent div fixed the problem.