How can you set a function outside of a class or is there a better way to do it?
I need to write something on the top of each page.. I can't use the Header()
because the written data has a variable height
require_once 'tcpdf/tcpdf.php';
class TCPDF_ext extends TCPDF {
public function AcceptPageBreak(){
$this->AddPage();
$this->lastpage();
$this->add_top();
return false;
}
}
$pdf = new TCPDF_ext();
$pdf->add_top = function(){
// write something on the top of each page
};