I'm struggling to understand how the header function is working in tcpdf.
Is is possible to use $pdf->writeHTML to the header?
http://www.tcpdf.org/examples/example_003.phps
I would like to display 3 columns in the header.
Column1 Column2 Column3
Below is the script to put in the header data: // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'PQR', 'XYZ');
$tcpdf = new TCPDF_TCPDF(); $img = file_get_contents(Mage::getBaseDir('media') . '/dhl/logo. jpg'); $PDF_HEADER_LOGO = $tcpdf->Image('@' . $img);//any image file.
Problem solved, credits to Simon @ https://sourceforge.net/p/tcpdf/discussion/435311/thread/505a9e13/
class MYPDF extends TCPDF {
public function Header() {
$headerData = $this->getHeaderData();
$this->SetFont('helvetica', 'B', 10);
$this->writeHTML($headerData['string']);
}
}
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->setHeaderData($ln='', $lw=0, $ht='', $hs='<table cellspacing="0" cellpadding="1" border="1"><tr><td rowspan="3">test</td><td>test</td></tr></table>', $tc=array(0,0,0), $lc=array(0,0,0));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With