Login
Username:

Password:


Lost Password?

Register now!
Mainmenue
FAQ - Speedlinks
PHP - Manual - Speedlinks
SmartFAQ is developed by The SmartFactory (http://www.smartfactory.ca), a division of InBox Solutions (http://www.inboxsolutions.net)
FAQ > PDF

FPDF: Wie kann ich einen Header (Seitenkopf) und Footer (Seitenfuß) erstellen?
Requested and Answered by Admin on 28-Nov-2005 23:35 (378 reads)
Das kann man folgendermaßen realisieren:


 
<?php
require('fpdf.php');
 
//Klasse muss Basisklasse beerben
class PDF extends FPDF
{
//Page header
function Header()
{
    //z.B. Ein Logo einbinden (muss vorhandne sein)
    $this->Image('logo.jpg',10,8,33);
    //Arial bold 15
    $this->SetFont('Arial','B',15);
    //Schiebt den kasten nach rechts
    $this->Cell(80);
    //Erstellt den Kasten mit folgenden Werten
    $this->Cell(30,10,'Title',1,0,'C');
    //Abstand zum Naechsten element (nach unten)
    $this->Ln(20);
}
 
//Page footer
function Footer()
{
    //Positioniert 1,5cm vom unteren Ende
    $this->SetY(-15);
    //Arial italic 8
    $this->SetFont('Arial','I',8);
    //Fuegt eine Seitennummer hinzu
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
 
//Erstellen der Klasse
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
//Gibt 40 Zeilen aus
for($i=1;$i<=40;$i++)
    $pdf->Cell(0,10,'Zeilenr: '.$i,0,1);
$pdf->Output();
?>
 


The comments are owned by the poster. We aren't responsible for their content.
php.a-bout.de ©2007 Stefan Freisler
Valid XHTML 1.0 Transitional Valid CSS!