0
Guys, I have a table with a very large number of lines and when I PDF this HTML page with domPDF does not skip to the next page. I tried some tutorials here, only it didn’t work very well.
Follow the image of the problem:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Resultado</title>
<link href="{{ asset('assets/plugins/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
@page { margin: 1cm; };
</style>
</head>
<body>
<header class="header" style="position: fixed; height:100px;">
<img src="{{ asset('assets/img/header_resultado.png') }}" class="img-responsive" alt="">
</header>
<div class="container" style="font-family: 'Roboto', sans-serif!important;">
<div class="col-md-12" style="position:absolute; top: 3cm;">
<div class="col-md-12 text-uppercase text-center">
<h4><strong>RESULTADO - </strong>CAMPUS {{ $campus->nome }} - {{ $curso->nome }} - {{ $curso_polo->turno }} - {{ $curso_polo->periodo }}º PERÍODO</h4>
</div>
<br>
<h4><strong>CANDIDATOS CLASSIFICADOS ATÉ O LIMITE DE VAGAS</strong></h4>
@php
$cont_1 = 1;
$cont_2 = count($resultado_limite_vagas) + 1;
@endphp
@if(count($resultado_limite_vagas) != 0)
<table class="table table-condensed table-bordered table-striped">
<tr>
<th style="text-align: center;">#</th>
<th>NOME</th>
<th>RG</th>
<th style="text-align: center;">NOTA</th>
</tr>
@foreach($resultado_limite_vagas as $rlv)
<tr>
<td width="40px" align="center">{{ $cont_1 }}</td>
<td>{{ $rlv->nome }}</td>
<td width="200px">{{ $rlv->rg }}</td>
<td width="60px" align="center">{{ $rlv->media }}</td>
</tr>
@php
$cont_1++;
@endphp
@endforeach
</table>
@else
<small>Não há candidatos classificados até o limite de vagas</small>
@endif
<br><br>
<h4><strong>CANDIDATOS CLASSIFICADOS ALÉM DO LIMITE DE VAGAS</strong></h4>
@if(count($resultado_alem_limite_vagas) != 0)
<table class="table" style="page-break-after: always;">
<tr>
<th width="40px" style="text-align: center;">#</th>
<th>NOME</th>
<th width="200px">RG</th>
<th style="text-align: center;">NOTA</th>
</tr>
@foreach($resultado_alem_limite_vagas as $ralv)
<tr>
<td align="center">{{ $cont_2 }}</td>
<td>{{ $ralv->nome }}</td>
<td>{{ $ralv->rg }}</td>
<td width="60px" align="center">{{ $ralv->media }}</td>
</tr>
@php
$cont_2++;
@endphp
@endforeach
</table>
@else
<small>Não há candidatos classificados além do limite de vagas</small>
@endif
</div>
</div>
</body>
</html>
// Montagem do PDF
$pdf = PDF::loadView('publico.resultado.resultado', compact('resultado_limite_vagas', 'resultado_alem_limite_vagas', 'curso', 'campus', 'curso_polo'));
$pdf->setPaper('A4');
return $pdf->stream('resultado.pdf');
Can someone help me?
What do you mean? because it pages automatically correctly? what is this page break?
– novic
Does it automatically page? It’s not doing this, it has some specific configuration?
– Fellipe Botelho
It makes it automatic, put your code in your question !
– novic
Ready, I put
– Fellipe Botelho
have you ever tried to print the PDF of this result? it does not create the pages?
– novic
It creates the PDF, the problem is that when the lines exceed the size of the A4 page a new page is not generated with the rest of the lines.
– Fellipe Botelho
Let’s go continue this discussion in chat.
– novic
Dude, I figured out the problem. Just take the style="position:Bsolute; top: 3cm;" and funk.
– Fellipe Botelho
What package was used?
– novic
Do you speak the library? I used the PDF gift
– Fellipe Botelho
Package name?
– novic