Salve, ho preso il codice dell'esempio 3 della libreria TCPDF e da un unico file sto cercando di trasformarlo in una classe mia in modo da riutilizzarla per tutto il sito.

Visto che non funziona vorrei capire dove è l'errore in modo da correggerlo.

Questo è il Codice

Codice PHP:
<?php
date_default_timezone_set
('Europe/Rome');
require_once(
LIBS 'tcpdf/config/lang/ita.php');
require_once(
LIBS 'tcpdf/tcpdf.php');

class 
MYPDF extends TCPDF {

    
//Page header
    
    
public function Header() {
        
// Logo
        
$image_file K_PATH_IMAGES.'logo_example.jpg';
        
$this->Image($image_file101015'''JPG''''T'false300''falsefalse0falsefalsefalse);
        
// Set font
        
$this->SetFont('helvetica''B'20);
        
// Title
        
$this->Cell(015'<< TCPDF Example 003 >>'0false'C'0''0false'M''M');
    }

    
// Page footer
    
public function Footer() {
        
// Position at 15 mm from bottom
        
$this->SetY(-15);
        
// Set font
        
$this->SetFont('helvetica''I'8);
        
// Page number
        
$this->Cell(010'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0false'C'0''0false'T''M');
    }
}

  Class 
pdf extends MYPDF
private 
$pdf;
   
    private function 
initfile() {
       
$pdffile = new MYPDF(PDF_PAGE_ORIENTATIONPDF_UNITPDF_PAGE_FORMATtrue'UTF-8'false);

// set document information
$pdffile->SetCreator(PDF_CREATOR);
$pdffile->SetAuthor('Nicola Asuni');
$pdffile->SetTitle('TCPDF Example 001');
$pdffile->SetSubject('TCPDF Tutorial');
$pdffile->SetKeywords('TCPDF, PDF, example, test, guide');

// set default header data
$pdffile->SetHeaderData(PDF_HEADER_LOGOPDF_HEADER_LOGO_WIDTHPDF_HEADER_TITLE.' 001'PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
$pdffile->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));

// set header and footer fonts
$pdffile->setHeaderFont(Array(PDF_FONT_NAME_MAIN''PDF_FONT_SIZE_MAIN));
$pdffile->setFooterFont(Array(PDF_FONT_NAME_DATA''PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdffile->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdffile->SetMargins(PDF_MARGIN_LEFTPDF_MARGIN_TOPPDF_MARGIN_RIGHT);
$pdffile->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdffile->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdffile->SetAutoPageBreak(TRUEPDF_MARGIN_BOTTOM);

//set image scale factor
$pdffile->setImageScale(PDF_IMAGE_SCALE_RATIO);

//set some language-dependent strings
$pdffile->setLanguageArray($l);

// ---------------------------------------------------------

// set default font subsetting mode
$pdffile->setFontSubsetting(true);

// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdffile->SetFont('dejavusans'''14''true);

// Add a page
// This method has several options, check the source code documentation for more information.
$pdffile->AddPage();

// set text shadow effect
$pdffile->setTextShadow(array('enabled'=>true'depth_w'=>0.2'depth_h'=>0.2'color'=>array(196,196,196), 'opacity'=>1'blend_mode'=>'Normal'));
return 
$pdffile;
    }

    public function 
crea() {
        
$this->pdf=$this->initfile();
        
$this->pdf->AddPage();

// set text shadow effect
        
$this->pdf->setTextShadow(array('enabled' => true'depth_w' => 0.2'depth_h' => 0.2'color' => array(196196196), 'opacity' => 1'blend_mode' => 'Normal'));

// Set some content to print
        
$html = <<<EOD
<style>
    h1 {
        color: navy;
        font-family: times;
        font-size: 24pt;
        text-decoration: underline;
        text-align:center;
    }
    p {
        color: #003300;
        font-family: helvetica;
        font-size: 12pt;
    }
   
</style>

<hr>
<h1>Prima Pagina PDF</h1>


Questa è la prima pagina HTML</p>
EOD;

// Print text using writeHTMLCell()
//$pdf->writeHTMLCell($w=0, $h=0, $x='10', $y='', $html, $border='T', $ln=1, $fill=0, $reseth=true, $align='', $autopadding=false);
        
$this->pdf->writeHTML($html$ln true$fill false$reseth false$cell false$align '');
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
        
$this->pdf->Output('example_001.pdf''I');
    }

}

?>
L'Editor mi segnala un errore in questa riga
Class pdf extends MYPDF{
Mentre in esecuzione la pagina mi da quest'errore
Fatal error: Call to undefined method view::initfile() in D:\Project Area\Progetti\website\omero\libs\pdf.php on line 90
che reputo senza senso visto che view non c'entra nulla !!
Grazie Daniele