2
require('../fpdf.php');
8
//Ordinate of column start
16
$this->SetFont('Arial','B',15);
17
$w=$this->GetStringWidth($title)+6;
18
$this->SetX((210-$w)/2);
19
$this->SetDrawColor(0,80,180);
20
$this->SetFillColor(230,230,0);
21
$this->SetTextColor(220,50,50);
22
$this->SetLineWidth(1);
23
$this->Cell($w,9,$title,1,1,'C',true);
26
$this->y0=$this->GetY();
33
$this->SetFont('Arial','I',8);
34
$this->SetTextColor(128);
35
$this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
40
//Set position at a given column
43
$this->SetLeftMargin($x);
47
function AcceptPageBreak()
49
//Method accepting or not automatic page break
53
$this->SetCol($this->col+1);
55
$this->SetY($this->y0);
61
//Go back to first column
68
function ChapterTitle($num,$label)
71
$this->SetFont('Arial','',12);
72
$this->SetFillColor(200,220,255);
73
$this->Cell(0,6,"Chapter $num : $label",0,1,'L',true);
76
$this->y0=$this->GetY();
79
function ChapterBody($file)
83
$txt=fread($f,filesize($file));
86
$this->SetFont('Times','',12);
87
//Output text in a 6 cm width column
88
$this->MultiCell(60,5,$txt);
91
$this->SetFont('','I');
92
$this->Cell(0,5,'(end of excerpt)');
93
//Go back to first column
97
function PrintChapter($num,$title,$file)
101
$this->ChapterTitle($num,$title);
102
$this->ChapterBody($file);
107
$title='20000 Leagues Under the Seas';
108
$pdf->SetTitle($title);
109
$pdf->SetAuthor('Jules Verne');
110
$pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt');
111
$pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt');