jaz*_*kat 3 pdf-generation header footer tcpdf text-coloring
任何人都知道如何更改页眉和页脚中的文本颜色以及线条颜色?在设置页眉/页脚之前简单地设置这两种颜色不适用于:
$pdf->SetTextColor(180);
$pdf->SetDrawColor(70);
Run Code Online (Sandbox Code Playgroud)
谢谢.
好的,发现它,我想你必须改变Header()和Footer()公共函数中的字体(在tcpdf.php中)对于文本颜色find:
$this->SetTextColor(0, 0, 0);
Run Code Online (Sandbox Code Playgroud)
在Header()和/或Footer()函数中并根据自己的喜好进行更改.
至于线条颜色,找到:
$this->SetLineStyle(array('width' => 0.85 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(70, 70, 70)));
Run Code Online (Sandbox Code Playgroud)
并在最后更改'color'数组.
干杯..
或者你也可以这样做:
通过扩展核心类并仅扩展其页脚功能:
// 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);
Run Code Online (Sandbox Code Playgroud)
希望这会对某人有所帮助。