Re: FPDF passing values into header and footer?
| From: | Angus Mann | Date: | Mon, 26 Apr 2010 06:23:39 +0000 |
| Subject: | Re: FPDF passing values into header and footer? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304587@lists.php.net to get a copy of this message | ||
----- Original Message ----- From: "Angus Mann" <angusmann@pobox.com>
To: "php-general" <php-general@lists.php.net>
Sent: Monday, April 26, 2010 2:46 PM
Subject: [PHP] FPDF passing values into header and footer?
Hi all. Whilst this question relates to fpdf (www.fpdf.org) I think it really is a PHP question, because it involves passing values into classes and functions.
Here's the problem .. I need to pass a PHP variable like $number into the header of a PDF.
I have extended the FPDF class as follows....
class PDF extends FPDF{
function Header(){
$this->SetFont('Arial','BU',12);
$this->Cell(0,5,'User notes for invoice number '.$number,0,'1','L');
}
}
I hate it when I ask a question prematurely, because I could have figured it out myself. Getter and Setter functions are the answer.
function setNumber($number){
$this->number = $number;
}
$pdf->setNumber('12345');