Break mPdf page using view

Asked

Viewed 126 times

0

I am using mPdf generating the pdf directly through a view because using the methods via php I could not make the css of my page work properly

$pdf = \PDF::loadView('contrato', array('desconto' => $desconto,
                                                'codigoAluno' => $codigoAluno,
                                                'qtdeParcelas' => $qtdeParcelas,
                                                'vencimento' => $vencimento,
                                                'cargaHoraria' => $cargaHoraria,
                                                'valorEntrada' => $valorEntrada,
                                                'valorComDesconto' => $valorComDesconto,
                                                'parcelaComDesconto' => $parcelaComDesconto,
                                                'valorSemDesconto' => $valorSemDesconto,
                                                'parcelaSemDesconto' => $parcelaSemDesconto,
                                                'pacote' => $pacote,
                                                'dataInicio' => $dataInicio,
                                                'razaoSocial' => $razaoSocial,
                                                'nomeFantasia' => $nomeFantasia,
                                                'cnpj' => $cnpj,
                                                'telefoneContratado' => $telefoneContratado,
                                                'enderecoContratado' => $enderecoContratado,
                                                'nomeContratante' => $nomeContratante,
                                                'cepContratante' => $cepContratante,
                                                'nascimentoContratante' => $nascimentoContratante,
                                                'enderecoContratante' => $enderecoContratante,
                                                'telefoneContratante' => $telefoneContratante,
                                                'rgContratante' => $rgContratante,
                                                'cpfContratante' => $cpfContratante,
                                                'nomeRepresentante' => $nomeRepresentante,
                                                'telefoneRepresentante' => $telefoneRepresentante,
                                                'rgRepresentante' => $rgRepresentante,
                                                'cpfRepresentante' => $cpfRepresentante,
                                                'cepRepresentante' => $cepRepresentante,
                                                'enderecoRepresentante' => $enderecoRepresentante,
                                                'pacote' => $pacote,
                                                'cursos' => $cursos,
                                                'clausulas' => $clausulas));
return $pdf->stream('document.pdf');

However I am not able to break the direct html page using <pagebreak />

[...]    
<div class="item w-100">
       <div class="item-titulo w-20">CPF:</div>
       <div class="item-conteudo">{{$cpfRepresentante}}</div>
</div>
</fieldset>
<hr>
@endif
<pagebreak />
1.1 - Quando empregadas no presente contrato...

Print do pdf não quebrando a página mesmo utilizando a tag

What can I do?

1 answer

1


already tried using div with page-break-before css?

<div style="page-break-before: always;"></div>

Before printing this div, it breaks the page and then you can print its contents

  • It worked!! Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.