$pdf = new MYPDF('P', 'mm', 'A4');
$ecm="1241231.jpg";
$pdf->setECM($ecm);
$pdf->Header();
$pdf->Output('filename.pdf', 'I'); //To force download }
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
public $ecm;
public function setECM($ecm)
{
$this->ecm = $ecm;
}
//Page header
public function Header() {
$ecm = $this->ecm;
....
}
}
Declaration of MYPDF::Header() should be compatible with TCPDF::Header()
Question
Hello to all!
I'm trying to override the Header method passing the variable $ecm
but I get this message:
"Declaration of MYPDF::Header() should be compatible with TCPDF::Header()"
What do you think? I can get around the obstacle? Thanks.
<code>
$pdf = new MYPDF('P', 'mm', 'A4');
$ecm="1241231.jpg";
$pdf->Header($ecm);
$pdf->Output('filename.pdf', 'I'); //To force download }
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
public function Header($ecm) {
....
}
}
</code>
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow