I am trying to create a header in TCPDF, however it always have a border underneath of it. Is there a way I can remove the bottom border?
tcpdf.php:
// print an ending header line
$this->SetLineStyle(array('width' => 0.25 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 255)));
Problem solved by extends the TCPDF class and modify the header and footer.
class MYPDF extends TCPDF {
public function Header()
{
$image_file = K_PATH_IMAGES.'pdf-header.jpg';
$this->Image($image_file, 160, 10, 40, '', 'JPG', '', 'T', false, 20, '', false, false, 0, false, false, false);
$this->SetFont('helvetica', 'B', 10);
}
public function Footer()
{
$this->SetY(-15);
$this->SetFont('helvetica', 'I', 8);
}
}
This works for some versions:
// Call before the addPage() method
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
Comment this line in Header() function of tcpdf Class :
$this->Cell(($this->w - $this->original_lMargin - $this->original_rMargin), 0, '', 'T', 0, 'C');
If you don't want to subclass or change the tcpdf source just call the setHeaderData
method and specify white line color.
$pdf->setHeaderData('',0,'','',array(0,0,0), array(255,255,255) );