每页的 tcpdf 颜色

tcpdf color for every page

我想在 tcpdf 中设置右边距的颜色。这是代码:

$bMargin = $pdf->getBreakMargin();

// get current auto-page-break mode

$auto_page_break = $pdf->getAutoPageBreak();

// disable auto-page-break

$pdf->SetAutoPageBreak(false, 0);

$pdf->Rect(0, 0, 10, 1000,'F',array(),array(199, 245, 206));

$pdf->SetAutoPageBreak($auto_page_break, $bMargin);

// set the starting point for the page content

$pdf->setPageMark();

问题是彩色右边距只出现在第一页上。我希望它显示在所有页面上。我该如何解决?

 class MYPDF extends TCPDF {

    //Page header
    public function Header() {
        // Logo


        $image_file = K_PATH_IMAGES.'logo_example.jpg';

        //$this->Image($image_file, 10, 5, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);

        // Set font

        $this->SetFont('helvetica', 'B', 20);

        $this->Rect(0, 0, 1000, 10,'F',array(),array(199, 245, 206));

        $this->SetTextColor(0, 0, 50);

        // Title

        $this->Cell(0, 15, 'mysite', 0, false, 'C', 0, '', 0, false, 'M', 'M');

        $bMargin = $this->getBreakMargin();

// get current auto-page-break mode

$auto_page_break = $this->getAutoPageBreak();

// disable auto-page-break

$this->SetAutoPageBreak(false, 0);

$this->Rect(0, 0, 13, 1000,'F',array(),array(199, 205, 206));

$this->SetAutoPageBreak($auto_page_break, $bMargin);

// set the starting point for the page content

$this->setPageMark();

    }

    // Page footer
    public function Footer() {
        // Position at 15 mm from bottom
        $this->SetY(-15);
        // Set font

        $this->SetFont('helvetica', 'I', 8);
        $this->SetTextColor(150, 50, 50);
        // Page number
        $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
    }

}