Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pessoal tenho esse arquivo rel_darf_mpdf.php que estava funcionando, mas quando passou de 1500 registros o arquivo PDF veio em branco. Então como faço para imprimir ou salvar uma página a cada 500 registro. Exemplo: 0 a 500 - pagina 1, 501 a 1000 - pagina 2, 1001 a 1500 - pagina 3. Veja o script em php que usa a classe mpdf que funcionava com até 1000 registros. <?php
//Funções para se conectar no banco de dados
require ("verifica.php"). include("conexao/bdinc.php"). //Fecha conexão // aumenta o tempo de execução do script//$nDarf = $_GET["id"]. $sql_darf = "SELECT * FROM con_darf ORDER BY id_darf LIMIT 0,1000". function mostraData ($data_empenho) {
if ($data_empenho!='') {
return (substr($data_empenho,8,2).'/'.substr($data_empenho,5,2).'/'.substr($data_empenho,0,4)). }
else { return ''. }
}<html lang="pt-br"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="card border-dark"> <div class="card-header bg-dark text-white"></div> <div class="card-body"> <div class="table-responsive-sm"> <table class="table table-striped"> <caption>RELATÓ. RIO DAS DARF</caption> <thead> <tr> <th nowrap="nowrap">ID</th> <th nowrap="nowrap"> Data Emissã. o</th> <th nowrap="nowrap">Data Vencimento</th> <th nowrap="nowrap">N°. DARF</th> <th nowrap="nowrap">Contribuinte</th> <th nowrap="nowrap">Nota Pagto</th> <th nowrap="nowrap">Processo</th> <th nowrap="nowrap">Perí. odo Apuraç. ã. o</th> <th nowrap="nowrap">Cod. Receita</th> <th nowrap="nowrap">Base Cá. lculo</th> <th nowrap="nowrap">Vr. DARF</th> <th nowrap="nowrap">Empenho</th> <th nowrap="nowrap">Subitem</th> </tr> </thead> <tbody>'.?>
<?php while ($linha = mysqli_fetch_array($res_darf)){ $html.= '<tr>'. $html.= '<td nowrap="nowrap">'.$linha[0].'</td>'. $html.= '<td nowrap="nowrap">'.mostraData($linha[1]).'</td>'. $html.= '<td nowrap="nowrap">'.mostraData($linha[2]).'</td>'. $html.= '<td nowrap="nowrap">'.$linha[3].'</td>'. $html.= '<td nowrap="nowrap">'.$linha[5].'</td>'. $html.= '<td nowrap="nowrap">'.$linha[6].'</td>'. $html.= '<td nowrap="nowrap">'.$linha[7].'</td>'. $html.= '<td nowrap="nowrap" style = "text-align: right". >'.mostraData($linha[8]).'</td>'. $html.= '<td nowrap="nowrap" style = "text-align: right". >'.$linha[9].'</td>'. $html.= '<td nowrap="nowrap" style = "text-align: right". >'.number_format($linha[10], 2, ',', '.').'</td>'. $html.= '<td nowrap="nowrap" style = "text-align: right". >'.number_format($linha[11], 2, ',', '.').'</td>'. $html.= '<td nowrap="nowrap">'.$linha[12].'</td>'. $html.= '<td nowrap="nowrap">'.$linha[13].'</td>'. $html.= '</tr>'. } // Fecha loop while } // Fecha o IF $html.= '</tbody> </table> </div> </div>
</div>
</body>
</html>?>
<?phprequire_once("mpdf/mpdf.php"). //$html = utf8_encode($html). $mpdf=new mPDF('c','A4'). //É fundamental definir o TIMEZONE de nossa região para que não tenhamos problemas com a geração.$mpdf->Output($arquivo,'I'). exit().?> Alguém pode dizer como faço isso?Carregando comentários...