Tags » Tcpdf

Pass variable to TCPDF class header or any class function


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);

PHP

No text display on TCPDF

I encountered this on one of my development, text are not displayed on TCPDF.

I was able to solve this by adding two things:

  1. // set default font subsetting mode…
  2. 15 more words
Development