westdc-zf1/include/fpdf/tutorial/tuto2.php

42 lines
783 B
PHP
Raw Normal View History

2009-03-06 03:20:46 +00:00
<?php
require('../fpdf.php');
class PDF extends FPDF
{
2011-11-03 02:25:38 +00:00
// Page header
2009-03-06 03:20:46 +00:00
function Header()
{
2011-11-03 02:25:38 +00:00
// Logo
$this->Image('logo.png',10,6,30);
// Arial bold 15
2009-03-06 03:20:46 +00:00
$this->SetFont('Arial','B',15);
2011-11-03 02:25:38 +00:00
// Move to the right
2009-03-06 03:20:46 +00:00
$this->Cell(80);
2011-11-03 02:25:38 +00:00
// Title
2009-03-06 03:20:46 +00:00
$this->Cell(30,10,'Title',1,0,'C');
2011-11-03 02:25:38 +00:00
// Line break
2009-03-06 03:20:46 +00:00
$this->Ln(20);
}
2011-11-03 02:25:38 +00:00
// Page footer
2009-03-06 03:20:46 +00:00
function Footer()
{
2011-11-03 02:25:38 +00:00
// Position at 1.5 cm from bottom
2009-03-06 03:20:46 +00:00
$this->SetY(-15);
2011-11-03 02:25:38 +00:00
// Arial italic 8
2009-03-06 03:20:46 +00:00
$this->SetFont('Arial','I',8);
2011-11-03 02:25:38 +00:00
// Page number
2009-03-06 03:20:46 +00:00
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
2011-11-03 02:25:38 +00:00
// Instanciation of inherited class
$pdf = new PDF();
2009-03-06 03:20:46 +00:00
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
for($i=1;$i<=40;$i++)
$pdf->Cell(0,10,'Printing line number '.$i,0,1);
$pdf->Output();
?>