Ciao a tutti!
Ho un problema da sottoporvi.
Sto usando TCPDF per creare file PDF.
Per costruire un'intestazione personalizzata devo estendere la classe interna di TCPDF ma mi da sempre il seguente errore:
Fatal error: Class declarations may not be nested in...
Il Codice è il seguente:
codice HTML:
// Include the main TCPDF library (search for installation path).
require_once('../../librerie/tcpdf/tcpdf_include.php');
require_once('../../librerie/tcpdf/tcpdf.php');
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
public function Header() {
// Logo
$this->SetFillColor(255, 255, 255);
$this->SetFont('times', '', 20);
$this->setCellMargins(0,10,0,0);
$this->setCellPaddings(2,2,0,0);
$this->SetFont('times', '', 10);
$this->MultiCell(170, 8, "<b>Titolo di esempio</b>", 1, 'C', 1, 1, '20', '', true,'0','false','true','50','M');
}
// Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', '', 8);
// Page number
$this->Cell(0, 10, 'P0001', 0, false, 'R', 0, '', 0, false, 'T', 'M');
}
}
Potrebbe essere un problema di librerie di PHP? O qualcosa riguardo ai permessi della libreria di TCPDF che è installato su Linux?
Grazie a tutti!
Michele