Ciao,

sto utilizzando FPDF.

Qui c'è la maschera che devo stampare creata utilizzando la classe FPDF: http://www.emilianoantonelli.it/fpdf/lavori/pdf.php

Gestisco queste maschere con PHP.
Sul web l'utente ha TOT maschere che possono essere stampate con l'utilizzo di FPDF, quindi in pdf. Ogni maschera deve essere stampata in una pagina A4.

Come vedete nel link la pagina "tipo" è fatta. Quando però vado a modificare la coordinata Y per riempire la seconda pagina accade un imprevisto. Tutti i valori sballano e non riesco a gestire più i testi nella pagina. Mi compaiono i testi sparsi per 5 pagine addirittura.

Non riesco quindi a mettere di seguito tot maschere per tot pagine.

Mi aiutate?

Questo è il codice:

Codice PHP:
<?php
require('../createpdf/fpdf.php');

class 
PDF extends FPDF
{
    
//Page header
    
function Header()
    {
        
//Times bold 15
        
$this->SetFont('Times','B',18);
        
//Move to the right
        
$this->Cell(80);
        
//Title
        
$this->Cell(30,10,'Titolo',0,0,'C');
        
//Line break
        
$this->Ln(20);
    }

    
//Page footer
    
function Footer()
    {
        
//Position at 1.5 cm from bottom
        
$this->SetY(-15);
        
//Times italic 8
        
$this->SetFont('Times','I',8);
        
//Page number
        
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
    }
}

//Instanciation of inherited class
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->SetAutoPageBreak("on");
$pdf->AddPage();

//Fields Name position
$Y_Fields_Name_position 20;
//Table position, under Fields Name
$Y_Table_Position 26;

$lb_name "NOME";
$lb_surname "COGNOME";
$txt_name "Provanome";
$txt_surname "Provacognome";

//RIGA 1
//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(10);
$pdf->MultiCell(12,6,$lb_name,0);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(100);
$pdf->MultiCell(18,6,$lb_surname,0);

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(24);
$pdf->MultiCell(75,6,$txt_name,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(118);
$pdf->MultiCell(75,6,$txt_surname,1);



//RIGA 2
$lb_natoa "NATO A";
$lb_natoil "IL";
$txt_natoa "Roma";
$txt_natoil "15/10/1979";


//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+15);
$pdf->SetX(10);
$pdf->MultiCell(14,6,$lb_natoa,0);
$pdf->SetY($Y_Table_Position+15);
$pdf->SetX(110);
$pdf->MultiCell(18,6,$lb_natoil,0,"C");

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+15);
$pdf->SetX(24);
$pdf->MultiCell(75,6,$txt_natoa,1);
$pdf->SetY($Y_Table_Position+15);
$pdf->SetX(125);
$pdf->MultiCell(18,6,$txt_natoil,1,"C");


//RIGA 3
$lb_residente "RESIDENTE A";
$lb_provincia "PROV.";
$txt_residente "Roma";
$txt_provincia "RM";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+30);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_residente,0);
$pdf->SetY($Y_Table_Position+30);
$pdf->SetX(135);
$pdf->MultiCell(18,6,$lb_provincia,0,"C");

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+30);
$pdf->SetX(43);
$pdf->MultiCell(90,6,$txt_residente,1);
$pdf->SetY($Y_Table_Position+30);
$pdf->SetX(150);
$pdf->MultiCell(18,6,$txt_provincia,1,"C");

//RIGA 3
$lb_via "IN VIA/PIAZZA";
$lb_cap "CAP";
$txt_via "Roma 200";
$txt_cap "00140";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+45);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_via,0);
$pdf->SetY($Y_Table_Position+45);
$pdf->SetX(135);
$pdf->MultiCell(18,6,$lb_cap,0,"C");

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+45);
$pdf->SetX(43);
$pdf->MultiCell(90,6,$txt_via,1);
$pdf->SetY($Y_Table_Position+45);
$pdf->SetX(150);
$pdf->MultiCell(18,6,$txt_cap,1,"C");


//RIGA 4
$lb_cf "CODICE FISCALE";
$txt_cf1 "1111";
$txt_cf2 "2222";
$txt_cf3 "3333";
$txt_cf4 "4444";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+60);
$pdf->SetX(10);
$pdf->MultiCell(30,6,$lb_cf,0);

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+60);
$pdf->SetX(45);
$pdf->MultiCell(18,6,$txt_cf1,1,"C");
$pdf->SetY($Y_Table_Position+60);
$pdf->SetX(65);
$pdf->MultiCell(18,6,$txt_cf2,1,"C");
$pdf->SetY($Y_Table_Position+60);
$pdf->SetX(85);
$pdf->MultiCell(18,6,$txt_cf3,1,"C");
$pdf->SetY($Y_Table_Position+60);
$pdf->SetX(105);
$pdf->MultiCell(18,6,$txt_cf4,1,"C");


//RIGA 5
$lb_qualifica "QUALIFICA";
$txt_qualifica "Violinista";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+75);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_qualifica,0);

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+75);
$pdf->SetX(43);
$pdf->MultiCell(90,6,$txt_qualifica,1);


//RIGA 6
$lb_coll "N° COLLOCAMENTO";
$lb_colldel "DEL";
$txt_coll "123456789";
$txt_colldel "11/01/2005";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+90);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_coll,0);
$pdf->SetY($Y_Table_Position+90);
$pdf->SetX(135);
$pdf->MultiCell(18,6,$lb_colldel,0,"C");

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+90);
$pdf->SetX(43);
$pdf->MultiCell(90,6,$txt_coll,1);
$pdf->SetY($Y_Table_Position+90);
$pdf->SetX(150);
$pdf->MultiCell(18,6,$txt_colldel,1,"C");

//RIGA 7
$lb_enpals "MATR E.N.P.A.L.S.";
$lb_enpalsdel "DEL";
$txt_enpals "123456789";
$txt_enpalsdel "22/02/2007";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+105);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_enpals,0);
$pdf->SetY($Y_Table_Position+105);
$pdf->SetX(135);
$pdf->MultiCell(18,6,$lb_enpalsdel,0,"C");

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+105);
$pdf->SetX(43);
$pdf->MultiCell(90,6,$txt_enpals,1);
$pdf->SetY($Y_Table_Position+105);
$pdf->SetX(150);
$pdf->MultiCell(18,6,$txt_enpalsdel,1,"C");

//RIGA 9
$lb_email "E-MAIL";
$txt_email "email@libero.it";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+120);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_email,0);

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+120);
$pdf->SetX(43);
$pdf->MultiCell(90,6,$txt_email,1);

//RIGA 10
$lb_sito "SITO WEB";
$txt_sito "www.sitointernet.it";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+135);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_sito,0);

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+135);
$pdf->SetX(43);
$pdf->MultiCell(90,6,$txt_sito,1);

//RIGA 11
$lb_cell1 "CELL. 1";
$txt_cell1 "3477777778";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+150);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_cell1,0);

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+150);
$pdf->SetX(43);
$pdf->MultiCell(45,6,$txt_cell1,1);


//RIGA 12
$lb_cell2 "CELL. 2";
$txt_cell2 "3487777779";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+165);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_cell2,0);

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+165);
$pdf->SetX(43);
$pdf->MultiCell(45,6,$txt_cell2,1);


//RIGA 13
$lb_altro "ALTRO NUMERO";
$txt_altro "065555555";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+180);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_altro,0);

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+180);
$pdf->SetX(43);
$pdf->MultiCell(45,6,$txt_altro,1);

//RIGA 14
$lb_parte "PRESTITO PARTE";
$txt_parte "SI";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+195);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_parte,0);

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+195);
$pdf->SetX(43);
$pdf->MultiCell(10,6,$txt_parte,1,'C');

//RIGA 15
$lb_note "NOTE";
$txt_note "Alcune note da inserire nella scheda .... Alcune note da inserire nella scheda .... Alcune note da inserire nella scheda .... Alcune note da inserire nella scheda .... Alcune note da inserire nella scheda .... Alcune note da inserire nella scheda .... Alcune note da inserire nella scheda .... Alcune note da inserire nella scheda .... Alcune note da inserire nella scheda ....";

//Now show the 2 columns Intestazione
$pdf->SetFont('Times','B',8);
$pdf->SetY($Y_Table_Position+205);
$pdf->SetX(10);
$pdf->MultiCell(35,6,$lb_note,0);

//Now show the 2 columns Contenuti
$pdf->SetFont('Times','',8);
$pdf->SetY($Y_Table_Position+205);
$pdf->SetX(43);
$pdf->MultiCell(150,6,$txt_note,1);




//Create lines (boxes) for each ROW (Product)
//If you don't use the following code, you don't create the lines separating each row
/* CICLO
$i = 0;
$pdf->SetY($Y_Table_Position);

while ($i < 2)
{
    $pdf->SetX(10);
    $pdf->MultiCell(120,6,'',0);
    $i = $i +1;
}
*/
 

$pdf->Output();
?>