目前我正在嘗試自定義whmcs發票pdf。他們有這個下面的代碼TCPDF如何設置兩種文字顏色?
# Payment Status
$endpage = $pdf->GetPage();
$pdf->setPage($startpage);
$pdf->SetXY(85,$addressypos);
if ($status=="Cancelled") {
$statustext = $_LANG["invoicescancelled"];
$pdf->SetTextColor(245,245,245);
} elseif ($status=="Unpaid") {
$statustext = $_LANG["invoicesunpaid"];
$pdf->SetTextColor(204,0,0);
} elseif ($status=="Paid") {
$statustext = $_LANG["invoicespaid"];
$pdf->SetTextColor(153,204,0);
} elseif ($status=="Refunded") {
$statustext = $_LANG["invoicesrefunded"];
$pdf->SetTextColor(34,68,136);
} elseif ($status=="Collections") {
$statustext = $_LANG["invoicescollections"];
$pdf->SetTextColor(255,204,0);
}
$pdf->SetFont('freesans','B',12);
$pdf->Cell(110,20,strtoupper($statustext),0,0,'C');
$pdf->setPage($endpage);
?>
此代碼產生這種格式,
例如,如果paymenet是 「無薪」,代碼產生這種回聲聲明
UNPAID(用紅色)
所以我想要做的是,我想添加這個文本「狀態:」infront的「UNPAID」,例如,當回聲出來時,它會變成這樣的
「狀態:未付」
我可以通過添加該代碼
} elseif ($status=="Unpaid") {
$statustext = $_LANG["statustext"];
$statustext = $_LANG["invoicesunpaid"];
$pdf->SetTextColor(245,245,245);
得到它,但因爲這個代碼
$pdf->SetTextColor(245,245,245);
狀態:變(紅)以及。
我能做些什麼來獲得狀態:黑色文字和UNPAID保持爲「紅色」。
請親切指出我。謝謝。