colonymech / docs / www / colonyscout / internal / fpdf16 / tutorial / tuto2.php @ f59acf11
History | View | Annotate | Download (732 Bytes)
1 |
<?php
|
---|---|
2 |
require('../fpdf.php'); |
3 |
|
4 |
class PDF extends FPDF |
5 |
{ |
6 |
//Page header
|
7 |
function Header() |
8 |
{ |
9 |
//Logo
|
10 |
$this->Image('logo_pb.png',10,8,33); |
11 |
//Arial bold 15
|
12 |
$this->SetFont('Arial','B',15); |
13 |
//Move to the right
|
14 |
$this->Cell(80); |
15 |
//Title
|
16 |
$this->Cell(30,10,'Title',1,0,'C'); |
17 |
//Line break
|
18 |
$this->Ln(20); |
19 |
} |
20 |
|
21 |
//Page footer
|
22 |
function Footer() |
23 |
{ |
24 |
//Position at 1.5 cm from bottom
|
25 |
$this->SetY(-15); |
26 |
//Arial italic 8
|
27 |
$this->SetFont('Arial','I',8); |
28 |
//Page number
|
29 |
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); |
30 |
} |
31 |
} |
32 |
|
33 |
//Instanciation of inherited class
|
34 |
$pdf=new PDF(); |
35 |
$pdf->AliasNbPages(); |
36 |
$pdf->AddPage(); |
37 |
$pdf->SetFont('Times','',12); |
38 |
for($i=1;$i<=40;$i++) |
39 |
$pdf->Cell(0,10,'Printing line number '.$i,0,1); |
40 |
$pdf->Output(); |
41 |
?>
|