目前我正在尝试自定义whmcs发票pdf.他们有以下代码
# 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);
?>
Run Code Online (Sandbox Code Playgroud)
此代码生成此格式,
例如,如果paymenet是"Unpaid",则代码会生成此echo语句
UNPAID(红色)
所以我想要做的是,我想在"UNPAID"面前添加这个文字"Status:",例如,当回显出来时,它会变成这样的
"状态:UNPAID"
我可以通过添加此代码来获取它
} elseif ($status=="Unpaid") {
$statustext = $_LANG["statustext"];
$statustext = $_LANG["invoicesunpaid"];
$pdf->SetTextColor(245,245,245);
Run Code Online (Sandbox Code Playgroud)
但是因为这段代码
$pdf->SetTextColor(245,245,245);
Run Code Online (Sandbox Code Playgroud)
状态:变为(红色).
获得状态我可以获得什么:文本黑色和UNPAID仍然是"红色".
请好好指出我.谢谢.
小智 5
在我需要编写内容之前,我已经设置了不同的文本颜色:$ pdf-> SetTextColor(0,0,0);
这是我的代码的一个例子:(正在写的实际文本在if语句之外,但我更改了文本的背景,因此我需要更改文本颜色以便可见)
if ($row_cnt > ($sticker_count / 2)) {
$pdf->SetTextColor(0,0,0);
$pdf->ImageSVG($file='images/sticker_29072013.svg', $xsi, $ysi, $w='60', $h='30', $link='', $align='', $palign='', $border, $fitonpage=false);
$pdf->ImageSVG($file='images/qr_29072013.svg', $xqi, $yqi, $w='30', $h='30', $link='', $align='', $palign='', $border, $fitonpage=false);
}
else {
$pdf->SetTextColor(255,255,255);
$pdf->ImageSVG($file='images/blacksticker_29072013.svg', $xsi, $ysi, $w='60', $h='30', $link='', $align='', $palign='', $border, $fitonpage=false);
$pdf->ImageSVG($file='images/blackqr_29072013.svg', $xqi, $yqi, $w='30', $h='30', $link='', $align='', $palign='', $border, $fitonpage=false);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23507 次 |
| 最近记录: |