PHP TCPDF remove header's bottom border

久未见 提交于 2019-11-29 16:08:07

问题


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?


回答1:


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



回答2:


This works for some versions:

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



回答3:


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



回答4:


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

    }
}



回答5:


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

$this->Cell(($this->w - $this->original_lMargin - $this->original_rMargin), 0, '', 'T', 0, 'C');


来源:https://stackoverflow.com/questions/7950493/php-tcpdf-remove-headers-bottom-border

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