Search code examples
phppdffpdf

FPDF : set position from inner page


Using fpdf to create my document, it works perfectly but for one thing. There is a superposition a one line on the footer part.

Here is my Pdf class header function :

function Header() {
  $this->setY(40);
  $titre="MY TITLE";
  $this->SetFont('Arial','B',16);
  .....
  doing all my stuff
  .....
  $this->Ln();
}

Here is the Footer method :

function Footer() {
   $this->SetY(-25); --postionning footer at 2.5 cm from the bottom
   ....
   doing my stuff
}

calling program:

$pdf = new Pdf();
$pdf->Open();
$pdf->addPage();
$request= "SELECT.....";
$result = $link->query($request) ; 
while($row=$result->fetchRow()) {
   $pdf->SetX(18);
   foreach($row as $champ=>$valeur) {
     ....
     displaying the fields in the document
     ...
   }
   $pdf->Ln();
}

My problem : it displays 1 line too much that superposes the Footer.

enter image description here

I would like to give a position between the footer and the inner page. Is that possible?

Thank you


Solution

  • Use the SetAutoPageBreak() method to increase the bottom margin, for example:

    $pdf = new Pdf();
    $pdf->SetAutoPageBreak(true, 40);