问题描述
im使用FPDF为我的报告生成PDF文件,并对此启动. 我想更改单元格内的填充颜色,但是每当我重新加载页面时,什么都没有 hapeens,它仍然具有相同的白色填充颜色.这是我的代码:
<?php require("fpdf/fpdf.php"); $pdf = new FPDF('P','pt','Letter'); $pdf->SetFillColor(230,230,230); $pdf->SetTitle("Title Here"); $pdf -> AddPage(); $pdf -> SetFont('Arial','',12); ?>
我的代码有什么问题?我遵循了设置填充颜色的正确方法,但什么也没有发生?谁能帮我修复它?谢谢
推荐答案
Tyr类似:
$pdf->setFillColor(230,230,230); $pdf->Cell(0,10,$text,0,1,'L',1); //your cell
定义用于所有填充操作(填充矩形和单元背景)的颜色.它可以用RGB组件或灰度表达. 该方法可以在创建第一页并从页面上保留到页面.
之前调用该方法.看看 fpdf手册
其他推荐答案
mpdf->SetFillColor('RED');
只是设置第七参数等于true
$mpdf->WriteCell(38, 10, 'HELLO', 1, 0, 'C', TRUE);
问题描述
Im using fpdf to generate a pdf file for my reports and Im new to this. I want to change the fill color inside a cell but whenever I reloaded the page, nothing hapeens, It still the same white fill color. Here is my code :
<?php require("fpdf/fpdf.php"); $pdf = new FPDF('P','pt','Letter'); $pdf->SetFillColor(230,230,230); $pdf->SetTitle("Title Here"); $pdf -> AddPage(); $pdf -> SetFont('Arial','',12); ?>
What is wrong with my code? I followed the proper way of setting the fill color but nothing happens? Can anyone help me fix it? Thanks
推荐答案
Tyr something like:
$pdf->setFillColor(230,230,230); $pdf->Cell(0,10,$text,0,1,'L',1); //your cell
Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page.
Take a look to the FPDF manual
其他推荐答案
mpdf->SetFillColor('RED');
Just set the seventh parameter equal to TRUE
$mpdf->WriteCell(38, 10, 'HELLO', 1, 0, 'C', TRUE);