class MYPDF extends TCPDF {
public $template;
public function setData($template){
$this->template = $template;
}
public function Header() {
// get the current page break margin
$bMargin = $this->getBreakMargin();
// get current auto-page-break mode
$auto_page_break = $this->AutoPageBreak;
// disable auto-page-break
$this->SetAutoPageBreak(false, 0);
// set bacground image
$img_file = 'uploads/template_background_image/'.$this->template.'.png';
$this->Image($img_file,0, 100, 390, 397, '', '', '', false, 300, '', false, false, 0);
// restore auto-page-break status
$this->SetAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content
}
}
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, array(400,500), true, 'UTF-8', false);
$pdf->setData($template);