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


TCPDF : convert HTML to pdf with TCPDF PHP library

Started in 2002, TCPDF is now one of the world’s most active Open Source projects, used daily by millions of users and included in thousands of CMS¬†and Web applications. 1,570 more words


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