3
I am using a loop to generate a PDF file. Each loop iteration should generate a PDF page.
The problem is that a blank page is always coming out at the end of the generated PDF. I know this page is coming out because I am using the CSS property
page-break-after:always
If I take the always
, page break is not correct. How can I fix?
THE HTML
@foreach($provas as $p)
<div class="page-break">
<div class="row">
<div class="col-md-12">
<h3 class="text-center">DNA Prova</h3>
</div>
</div>
<Restante do conteúdo da página>
</div>
@endforeach
THE CSS
.page-break{
page-break-after: always;
}
You wrote it right? Yeah
always
.– Diego Souza
True, I wrote it right in the wrong code here. Thank you
– Amanda Lima
You tried to use
auto
?– Diego Souza
I tried. As I said, if you use anything other than Always, the page break is wrong
– Amanda Lima
How’s your HTML? You can post ?
– Diego Souza
place
auto
doesn’t solve?– Gabriel Rodrigues
@Diegosouza, I edited the question and put the code
– Amanda Lima
@Gabrielrodrigues if I use the auto, the page break is wrong.
– Amanda Lima
Make a CSS like this:
.page-break:last-of-type{
 page-break-after: auto;
}
– Diego Souza
It didn’t work, the page doesn’t break at the right place
– Amanda Lima