php - FPDF class extend not working -


i'm having problem fpdf because class extend it's not working.

i'm creating class footer , call with:

$pdf = new pdf2(); 

i have code in external file include above code, this:

include"fpdf.php";  class pdf2 extends tfpdf {     // page footer     function footer()     {         // mb logo 30cm before end of page         $y = $this->sety(-65);         // arial italic 8         $this->addfont('dejavu','','dejavusanscondensed.ttf',true);         $this->setfont('dejavu','',10);         //mb logo         $this->image('img/multibanco.jpg',20,$y,30);     } }  //pdf begins // cliente info encomenda $pdf = new tfpdf(); $pdf = new pdf(); $pdf = new pdf2(); $pdf->addpage();  // arial bold 15 $pdf->addfont('dejavu','','dejavusanscondensed.ttf',true); $pdf->setfont('dejavu','',11);  // title $pdf->cell(190,10,'ordem nº '.$maxi.'',0,0,'c');  // line break $pdf->ln(20);  // add unicode font (uses utf-8) $pdf->addfont('dejavu','','dejavusanscondensed.ttf',true); $pdf->setfont('dejavu','',10);  // cliente nome/email $pdf->cell(150,10,'cliente: '.$enc['nome'].' '.$enc['apelido'].' ',0,1); $pdf->cell(150,10,'email: '.$enc['email'].'',0,1); $pdf->setfillcolor(232, 232, 232);   //messagem  $pdf->roundedrect(10, 50, 190, 10, 3.5,true); $pdf->cell(190,10,'mensagem',0,1,'l'); //header $pdf->setfillcolor(255, 255, 255); // background $pdf->multicell(180,5,'text',0,'j',0); // mensagem  //tabela $html =''; $html='<table border="0">     <tr>         <td width="230" height="40" bgcolor="#e6e6e6">tipo</td>         <td width="88" height="40" bgcolor="#e6e6e6">formato</td>         <td width="88" height="40" bgcolor="#e6e6e6">nº interno</td>         <td width="88" height="40" bgcolor="#e6e6e6">revelar</td>         <td width="88" height="40" bgcolor="#e6e6e6">digitalizar</td>         <td width="88" height="40" bgcolor="#e6e6e6">edição</td>         <td width="88" height="40" bgcolor="#e6e6e6">impressão</td>     </tr>';  while($pdf_info2 = $smth->fetch(pdo::fetch_assoc)) {     $html .= '         <tr>             <td width="230" height="40" bgcolor="#f7f7f7">'.$pdf_info2['tipo'].'</td>             <td width="88" height="40" bgcolor="#f7f7f7">'.$pdf_info2['formato'].'</td>             <td width="88" height="40" bgcolor="#f7f7f7">&nbsp;</td>             <td width="88" height="40" bgcolor="#f7f7f7">'.$pdf_info2['revelar'].'</td>             <td width="88" height="40" bgcolor="#f7f7f7">'.$pdf_info2['digitalizar'].'</td>             <td width="88" height="40" bgcolor="#f7f7f7">'.$pdf_info2['edicao'].'</td>             <td width="88" height="40" bgcolor="#f7f7f7">'.$pdf_info2['impressao'].'</td>         </tr>'; }  $pdf->writehtml($html);  //output + ln $pdf->ln(10); $pdf->output(); 

any errors of class not displayed, @ least don't see them without error_reporting(0) commented.

you must not declare object $pdf more once, must call file tfpdf.php, there built class tfpdf().

example

<?php  // optionally define filesystem path system fonts // otherwise tfpdf use [path tfpdf]/font/unifont/ directory // define("_system_ttfonts", "c:/windows/fonts/");  require('tfpdf.php');  $pdf = new tfpdf(); $pdf->addpage();  // add unicode font (uses utf-8) $pdf->addfont('dejavu','','dejavusanscondensed.ttf',true); $pdf->setfont('dejavu','',14);  // load utf-8 string file , print $txt = file_get_contents('helloworld.txt'); $pdf->write(8,$txt);  // select standard font (uses windows-1252) $pdf->setfont('arial','',14); $pdf->ln(10); $pdf->write(5,'the file size of pdf 12 kb.');  $pdf->output(); ?> 

download class tfpdf() in http://www.fpdf.org


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -