I have an application already prepared in which one of its modules is to generate PDF reports, the report is generated excellent, the detail is that I need every 20 records to generate a new page of this report but it is generated in white and this should not be the case. How can I make this new page with its header and structure like the previous page of the document? I am a computer student and since I am acquiring knowledge, I will appreciate your help please. The library that I am using is FPDF this is the code:
<?php
require "pdf/fpdf.php";
class PDF extends FPDF
{
}
//declaramos la hoja
$pdf= new PDF ('L','mm',array(500, 500));
$pdf->SetMargins(10,5);
$pdf->SetTopMargin(2);
$pdf->SetLeftMargin(10);
$pdf->AliasNbPages();
$pdf->SetAutoPageBreak(true,155);
$pdf->AddPage();
//Datos del titulo
$pdf->SetTextColor(0x00, 0x00, 0x00);
$pdf->SetFont("Arial", "", 9);
$pdf->Image('logo.png' , 390,20, 35 , 38,'png','');
$pdf->Cell(0, 20, '', 0, 1, 'C');
$pdf->Cell(0, 5, 'REPUBLICA BOLIVARIANA DE VENEZUELA', 0, 1, 'C');
$pdf->Cell(0, 5, 'AGENCIA AUTOMOTRIZ ALLCARS', 0, 1, 'C');
$pdf->ln();
$pdf->SetFont("Arial", "", 12);
$pdf->Cell(0, 5, 'INVENTARIO FISICO', 0, 1, 'C');
$pdf->Cell(0, 5, 'AUTOS:', 0, 1, 'C');
$pdf->Cell(0, 5, 'FECHA:', 0, 1, 'C');
//Datos de conexion
mysql_connect("localhost", "USER", "PASSWORD");
mysql_select_db("BASE_DE_DATOS");
//FIN DE DATOS DE CONEXION
$sql="SELECT * FROM tabla";
$rec= mysql_query($sql);
while ($row=mysql_fetch_array($rec))
{
$pdf->Cell(0,5, $row['fecha'], 0, 0, 'C');
}
$pdf->ln();
$pdf->Ln();
$pdf->SetFontSize(8);
$pdf->SetTextColor(0x00, 0x00, 0x00);
$pdf->SetFont("Arial", "", 8);
$pdf->Cell(265, 5, '1.- CLIENTE:', 1, 0, 'C');
$pdf->Ln();
$pdf->Cell(40, 5, 'CEDULA DE IDENTIDAD', 1, 0, 'C');
$pdf->Cell(120, 5, 'APELLIDOS Y NOMBRES', 1, 0, 'C');
$pdf->Cell(20, 5, 'DIRECCION', 1, 0, 'C');
$pdf->Cell(85, 5, 'CEDULA', 1, 0, 'C');
$pdf->SetFontSize(9);
$sql="SELECT * FROM encabezado";
$rec= mysql_query($sql);
while ($row=mysql_fetch_array($rec))
{
$pdf->Cell(80, 10, $row['direccion_li'], 1, 0, 'C');
$pdf->Cell(30, 10, $row['cod_ut'], 1, 0, 'C');
$pdf->Cell(90, 10, $row['division'], 1, 0, 'C');
$pdf->Cell(0, 5, '', 0, 0, 'C');
}
**//
// AQUI NECESITO QUE SIGA CON EL FORMATO YA ESTABLECIDO EN UNA NUEVA HOJA**
$pdf->Ln();
$pdf->SetFontSize(9);
$sql="SELECT * FROM encabezado";
$rec= mysql_query($sql);
while ($row=mysql_fetch_array($rec))
{
$pdf->Cell(40, 5, $row['ced'], 1, 0, 'C');
$pdf->Cell(120, 5, $row['nombres'], 1, 0, 'C');
$pdf->Cell(20, 5, $row['codigo'], 1, 0, 'C');
$pdf->Cell(85, 5, $row['uep'], 1, 0, 'C');
}
**//
// HASTA AQUI**
$pdf->Ln();
$pdf->SetFontSize(9);
$pdf->Cell(170, 5, 'DIRECTOR', 0, 0, 'C');
$pdf->Cell(170, 5, 'CLIENTE', 0, 0, 'C');
$pdf->Ln();
$pdf->Ln();
$pdf->Cell(170, 5, 'FIRMA', 0, 0, 'C');
$pdf->Cell(170, 5, 'FIRMA', 0, 0, 'C');
$pdf->Output(/*$Archivo, $tipo_output*/);
//$pdf->Output("Contrato_".$per_Rut."-".$per_DV.".pdf", "D");
?>
in the part that you specify as a comment is the one that shows me the list of the data stored in the database before, what I need is that each time a new page is generated, the format as (logo, header, date, lower signatures, etc) already appears, just keep showing me results of the list if there are any