2012-02-02 92 views
2

任何人都知道如何更改页眉和页脚中的文本颜色以及线条颜色? 设置页眉/页脚不工作之前,简单地设置这两种颜色:更改TCPDF标题中的文本颜色

$pdf->SetTextColor(180); 
$pdf->SetDrawColor(70); 

感谢。

回答

5

好了,找到了, 我猜你必须改变字体在头()页脚()公共功能(在tcpdf.php) 对于文本的颜色找到:

$this->SetTextColor(0, 0, 0); 

在Header()和/或Footer()函数中,并根据自己的喜好进行更改。

至于线颜色,发现:

$this->SetLineStyle(array('width' => 0.85/$this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(70, 70, 70))); 

并在结束改变它的 '颜色' 的数组。

欢呼声..

4

或者你也可以做到这一点也以此方式:

通过扩展核心类和扩展只是它页脚功能:

// Extend the TCPDF class to create custom Header and Footer 
class MYPDF extends TCPDF { 
// Page footer 
public function Footer() { 
    //set text color 
$this->SetTextColor(255,0,0); 

} 
} 

// create new PDF document 
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); 

希望这会帮助别人。