Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在TCPDF中设置背景色_Php_Html_Css_Tcpdf - Fatal编程技术网

Php 在TCPDF中设置背景色

Php 在TCPDF中设置背景色,php,html,css,tcpdf,Php,Html,Css,Tcpdf,我已经手动设置了第一页的背景色,如下所示: $pdf->AddPage(); $pdf->SetFillColor(52, 21, 0, 76); $pdf->Rect(0, 0, $pdf->getPageWidth(), $pdf->getPageHeight(), 'DF', ""); 我试图在for each循环中设置背景色,以防元素使用此选项跳转到下一页 if (!empty($extra_curricular_data)) { foreach

我已经手动设置了第一页的背景色,如下所示:

$pdf->AddPage();

$pdf->SetFillColor(52, 21, 0, 76);
$pdf->Rect(0, 0, $pdf->getPageWidth(), $pdf->getPageHeight(), 'DF', "");
我试图在for each循环中设置背景色,以防元素使用此选项跳转到下一页

if (!empty($extra_curricular_data)) {
    foreach ($extra_curricular_data as $data) {
        $extra_curricular_details .= <<<EOD
    <p style="font-family: courier; color: #F5F5F5;"><strong>  {$data['title']}</strong></p>
    <p style="color: #F5F5F5;">{$data['description']}</p>
EOD;
        if ((int)$pdf->getAliasNumPage() > 1) {
            $this->SetFillColor(52, 21, 0, 76);
            $this->Rect(0, 0, $this->getPageWidth(), $this->getPageHeight(), 'DF', "");
        }
    }

    $pdf->writeHTMLCell(0, 0, '', '', $extra_curricular_details, 1, 1, 0, true, 'L', true);
}
if(!empty($extractural\u data)){
foreach($data形式的课外数据){
$Extral_-currential_details.=SetFillColor(52,21,0,76);
$this->Rect(0,0,$this->getPageWidth(),$this->getPageHeight(),'DF',“”);
}
}
$pdf->WriteHTML单元格(0,0,,'','',$Extral\u-culturer\u-details,1,1,0,true,'L',true);
}

但我还是没能做到。

可能是重复的。你读过我写的关于函数rect如何工作的文章吗?我将其标记为重复,并在原始答案上编辑我的答案