0
I have a query that returns me 8,093 records both in the database and in a PHP system. I’m making a report using mPDF that regardless of the filter, it only generates 6 pages, which in my opinion, rules out the possibility of picking up any null or unformatted data. My report has header and footer and is printing 25 lines per page.
<?php
include 'MPDF57/mpdf.php';
include 'conect/conecta.php';
include 'banco-os.php';
include 'logica-usuario.php';
$OSid = $_POST['OSid'];
$dataHora = $_POST['dataHora'];
$NomeEquipamento = $_POST['NomeEquipamento'];
$NomeSetor = $_POST['NomeSetor'];
$motivoOs = $_POST['motivoOs'];
$TotalMaterial = $_POST['TotalMaterial'];
$NomeTipoOS = $_POST['NomeTipoOS'];
$status = $_POST['status'];
$topo = "
<table border='1' class='table table-striped' style='font-size: 12px;' >
<tr>
<td colspan='1' width='10%'><img src='imagens/logo-mini.png' class='img-responsive img-rounded'></td>
<td colspan='7' width='90%' class='textCenter'>
<p>
Av. Lobo Júnior, 688 - Penha Circular - Rio de Janeiro - RJ<br>CEP: 21020-125
Telefones: 2156-0500<br > Assistência Técnica: 2156-0525 <br>
E-mail: <a href='mailto:[email protected]'>[email protected]</a> - Site: <a href='www.riomed.com.br'>www.riomed.com.br</a>
</p>
</td>
</tr>
</table>";
$corpo_pagina = "
<!DOCTYPE html>
<html lang='pt-br'>
<head>
<meta charset='UTF-8'>
<title>Relatório - RioMed</title>
<link href='css/bootstrap.css' rel='stylesheet'>
<style media='print'>
body {
font-family: sans-serif;
}
a {
color: #000066;
text-decoration: none;
}
table {
border-collapse: collapse;
}
thead {
vertical-align: bottom;
text-align: center;
font-weight: bold;
}
tfoot {
text-align: center;
font-weight: bold;
}
th {
text-align: left;
padding-left: 0.35em;
padding-right: 0.35em;
padding-top: 0.35em;
padding-bottom: 0.35em;
vertical-align: top;
}
td {
padding-left: 0.35em;
padding-right: 0.35em;
padding-top: 0.35em;
padding-bottom: 0.35em;
vertical-align: top;
}
.textCenter{
text-align: center;
}
img {
margin: 0.2em;
vertical-align: middle;
}
table.print-friendly tr td, table.print-friendly tr th {
page-break-inside: avoid;
}
</style>
</head>
<body>
<table border='1' class='table table-striped' style='font-size: 12px;' >
<thead>
<tr>
<th width='6%'>COD OS</th>
<th width='8%'>DATA</th>
<th>SETOR</th>
<th>EQUIPAMENTO</th>
<th width='12%'>CUSTO TOTAL</th>
<th>TIPO OS</th>
<th width='17%'>STATUS</th>
</tr>
</thead>";
for($i = 0; $i < count($OSid); $i++){
$corpo_pagina .="
<tr>
<td>".$OSid[$i]."</td>
<td>".$dataHora[$i]."</td>
<td>".$NomeSetor[$i]."</td>
<td>".$NomeEquipamento[$i]."</td>
<td>".$TotalMaterial[$i]."</td>
<td>".$NomeTipoOS[$i]."</td>
<td>".$status[$i]."</td>
</tr>
";
}
$corpo_pagina .= "</table>";
$rodape = "
<table width='100%' style='vertical-align: bottom; font-family: serif; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;'>
<tr>
<td width='33%'><span style='font-weight: bold; font-style: italic;'>{DATE d/m/Y}</span></td>
<td width='33%' align='center' style='font-weight: bold; font-style: italic;'>{PAGENO}/{nbpg}</td>
<td width='33%' style='text-align: right; '>Rio Med</td>
</tr>
</table>
</body>
</html>
";
date_default_timezone_set('America/Sao_Paulo');
$date = date('d/m/Y H:i');
$arquivo = $date." - Relatorio.pdf";
$mpdf = new mPDF('utf-8', 'A4-L',7,'MS Serif',7,7,27,13);
$mpdf->SetDisplayMode('fullpage');
$mpdf->SetHTMLHeader($topo,'0',true);
$mpdf->SetHTMLFooter($rodape);
$mpdf->AddPageByArray(array(
'orientation' => 'L',
'mgl' => '10',
'mgr' => '10',
'mgt' => '30',
'mgb' => '20',
'mgh' => '10',
'mgf' => '10',
));
$mpdf->writeHTML($corpo_pagina);
$mpdf->Output($arquivo, 'I');
exit();
has come to check memory and disk space issues? Some processes may be interrupted in these situations. As for mPDF, I always preferred TCPDF because it is available in packagist
– Gabriel Heming
Knew q the post has limit. I do not know if it can increase. 8gb ram memory without locking and hd should have some 800gb Libres. i5.
– fabricio_wm
now that I realized that all data comes by POST. That’s right, there is a directive called
post_max_size
that sets the maximum post size in MB. Another directive ismax_input_vars
that defines how many variables can be inserted in a query string, whether get or post. You should change them.– Gabriel Heming
Another point, in the case of memories, the PC is one thing, the memory that PHP uses is defined by directives in the
php.ini
, in this case, if the above changes do not work, try checking on the memory in use.– Gabriel Heming
It didn’t work. http://imgur.com/a/w7Zk9 Nothing has changed. You know what can be?
– fabricio_wm
http://imgur.com/a/EoeqO Look at the result of my report. Whatever information is presented in the report, always in the same place.
– fabricio_wm
what were the modifications you made? Restarted apache as amended?
– Gabriel Heming
; How Many GET/POST/COOKIE input variables may be accepted ; max_input_vars = 1000 Para ; How Many GET/POST/COOKIE input variables may be accepted max_input_vars = 1000 E essa ; http://php.net/post-max-size post_max_size=32M
– fabricio_wm
Your max_input_vars remains the same, increase to 10000 and test.
– Gabriel Heming
It worked. But I had to increase the timeout from 30 to 3000. Only there the answer so I can score.
– fabricio_wm
Now it’s only going up to 58 pages. I made a query of 8,083 records and this should return me 323 pages. There is no need to print such a report. Then I will make improvement to pass only the parameter via post and generate the report straight from the database. Thanks.
– fabricio_wm
I got it. I put max_input_vars for 9000 and post_max_size =128M Thanks.
– fabricio_wm
Answer your own question. It is better if people know that you have solved the problem, and how you solved the problem.
– ShutUpMagda
@Gabrielheming Fabor put his solution as answer to finalize this question. Solved by increasing the memory of the post.
– fabricio_wm
Good morning, what helped me was to increase Pcre.backtrack_limit = 100000 to 9000000. In php.ini Valew
– Charles de Azevedo Júnior