Welcome Guest, Not a member yet? Register   Sign In
FPDF - Extending the Class
#1

[eluser]richman[/eluser]
Hi Everyone,

I am not sure if I am being a little silly or just not seeing the light but I have just started using FPDF(I need this to work on php4) and have added the class to my libary folder.

I can create basic PDF's but I cannot seem to work out how or were to extend the class as per the examples on the FPDF website.

Code:
<?php
require('fpdf.php');

class PDF extends FPDF
{
//Page header
function Header()
{
    //Logo
    $this->Image('logo_pb.png',10,8,33);
    //Arial bold 15
    $this->SetFont('Arial','B',15);
    //Move to the right
    $this->Cell(80);
    //Title
    $this->Cell(30,10,'Title',1,0,'C');
    //Line break
    $this->Ln(20);
}

//Page footer
function Footer()
{
    //Position at 1.5 cm from bottom
    $this->SetY(-15);
    //Arial italic 8
    $this->SetFont('Arial','I',8);
    //Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}

//Instanciation of inherited class
$pdf=new PDF();
$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();
?&gt;

I guess my question is how do you extend this class as I cannot do this in a controller as it is already a class.

It would be great if somebody had a sinple way to get around this.

Regards

Rich


Messages In This Thread
FPDF - Extending the Class - by El Forum - 06-19-2008, 02:37 AM
FPDF - Extending the Class - by El Forum - 06-19-2008, 04:28 AM
FPDF - Extending the Class - by El Forum - 06-19-2008, 10:20 AM
FPDF - Extending the Class - by El Forum - 06-19-2008, 11:09 AM
FPDF - Extending the Class - by El Forum - 06-19-2008, 12:09 PM
FPDF - Extending the Class - by El Forum - 06-19-2008, 12:24 PM
FPDF - Extending the Class - by El Forum - 06-19-2008, 02:30 PM
FPDF - Extending the Class - by El Forum - 06-20-2008, 01:24 AM
FPDF - Extending the Class - by El Forum - 09-15-2008, 04:24 PM
FPDF - Extending the Class - by El Forum - 09-15-2008, 05:44 PM
FPDF - Extending the Class - by El Forum - 09-15-2008, 06:13 PM
FPDF - Extending the Class - by El Forum - 09-15-2008, 06:44 PM
FPDF - Extending the Class - by El Forum - 10-17-2008, 12:02 PM
FPDF - Extending the Class - by El Forum - 10-19-2008, 05:39 PM
FPDF - Extending the Class - by El Forum - 07-11-2009, 02:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB