Re: FPDF Help
| From: | Tom Rogers | Date: | Thu, 15 Apr 2004 16:54:41 +0000 |
| Subject: | Re: FPDF Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183490@lists.php.net to get a copy of this message | ||
Hi,
Friday, April 16, 2004, 2:38:24 AM, you wrote:
NM> Anyone who is familiar with using FPDF to generate PDFs, I'd really
NM> appreciate some suggestions here:
NM> I am using the following code, virtually identical to that used in the
NM> FPDF tutorial examples. But I keep getting a parse error for the first
NM> line containing the variable $this. In the tutorial they do not
NM> declare this variable prior to using it the same way as in the example
NM> below, but when I try and do this, it's a no go.
NM> Any ideas? Suggestions?
NM> the code
NM> --
NM> define('FPDF_FONTPATH','../../../font/');
NM> require('../fpdf.php');
NM> class PDF extends FPDF
NM> {
NM> function Header()
NM> {
NM> //Arial 12
$this->>SetFont('Arial','',12);
NM> //Move to the right
$this->>Cell(80);
NM> //Title
$this->>Cell(30,10,'Title',1,0,'C');
NM> //Line break
$this->>Ln(20);
NM> }
NM> function Footer()
NM> {
NM> //Position at 1.5 cm from bottom
$this->>SetY(-15);
NM> //Arial italic 8
$this->>SetFont('Arial','I',8);
NM> //Page number
$this->>Cell(0,10,'Page
'.$this->PageNo().'/{nb}',0,0,'C');
NM> }
NM> $pdf=new PDF();
$pdf->>AliasNbPages();
$pdf->>AddPage();
$pdf->>SetFont('Times','',12);
NM> for($i=1;$i<=40;$i++)
NM> {
$pdf->>Cell(0,10,'Printing line number '.$i,0,1);
NM> }
$pdf->>Output();
NM> }
NM> Nathan Mealey
NM> Director of Operations
NM> Cycle-Smart, Inc.
NM> P.O. Box 1482
NM> Northampton, MA
NM> 01061-1482
NM> nathan@cycle-smart.com
NM> (413) 587-3133
NM> (413) 210-7984 Mobile
NM> (512) 681-7043 Fax
NM> --
NM> PHP General Mailing List (http://www.php.net/)
NM> To unsubscribe, visit: http://www.php.net/unsub.php
looks like your missing the closing } to your class
proper indenting would probably help
--
regards,
Tom