PHP TCPDF remove header's bottom border

自古美人都是妖i 提交于 2019-11-30 10:54:33

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)));
András

This works for some versions:

// Call before the addPage() method
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);

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

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

    }
}
Rkk

Comment this line in Header() function of tcpdf Class :

$this->Cell(($this->w - $this->original_lMargin - $this->original_rMargin), 0, '', 'T', 0, 'C');
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!