title: How to set the background color for every page tcpdf
body: <p>I'm currently using TCPDF to generate a resume in my web application. But with the limited support for css have cornered me.
  Now I'm trying to apply the background color for the every page that is generated. But I'm only getting the color for the first page.</p>
  
  <p>My code is: </p>
  
  <pre><code>&lt;?php
  class PROFILE_PDF extends TCPDF
  {
      public function Header()
      {
          $this-&gt;SetFillColor(52, 21, 0, 76);
          $this-&gt;Rect(0, 0, $this-&gt;getPageWidth(), $this-&gt;getPageHeight(), 'DF', "");
      }
  
  
      private $footer_data = array();
  
  
      public function Footer()
      {
          // Position at 15 mm from bottom
          $this-&gt;SetY(-15);
          // Set font
          $this-&gt;SetFont('helvetica', 'I', 8);
          // Page number
  
  
          $name = &lt;&lt;&lt; EOD
          &lt;p&gt;Curriculum Vitae - {$this-&gt;footer_data["name"]}&lt;/p&gt;
          &lt;style&gt;
              p {
                  color: #F5F5F5;
              }
          &lt;/style&gt;
  
          EOD;
          $this-&gt;writeHTMLCell(0, 10, '', '', $name, 0, 1, 0, true, 'L', true);
  
          $page = &lt;&lt;&lt; EOD
  
          &lt;p&gt;Page  {$this-&gt;getAliasNumPage()} /   {$this-&gt;getAliasNbPages()}&lt;/p&gt;
          &lt;style&gt;
              p {
                  color: #F5F5F5;
              }
          &lt;/style&gt;
  
          EOD;
  
          $this-&gt;writeHTMLCell(0, 10, '', 284, $page, 0, 1, 0, true, 'R', true);
  
          $style = array('width' =&gt; 0.5, 'cap' =&gt; 'butt', 'join' =&gt; 'miter', 'dash' =&gt; 0, 'color' =&gt; array(128, 229, 255));
          $this-&gt;Line(0, 275, 250, 275, $style);
      }
  
      public function setFooterData($footer_data)
      {
          $this-&gt;footer_data = $footer_data;
      }
  
  $pdf = new PROFILE_PDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  
  
  $pdf-&gt;SetLineStyle(array('width' =&gt; 2, 'color' =&gt; array(112, 128, 144)));
  
  $pdf-&gt;Line(0, 0, $pdf-&gt;getPageWidth(), 0);
  $pdf-&gt;Line($pdf-&gt;getPageWidth(), 0, $pdf-&gt;getPageWidth(), $pdf-&gt;getPageHeight());
  $pdf-&gt;Line(0, $pdf-&gt;getPageHeight(), $pdf-&gt;getPageWidth(), $pdf-&gt;getPageHeight());
  $pdf-&gt;Line(0, 0, 0, $pdf-&gt;getPageHeight());
  
  // set header data
  $footer_data = array();
  $footer_data["name"] = $personal_data["first_name"] . " " . $personal_data["last_name"];
  $pdf-&gt;setFooterData($footer_data);
  
  $pdf-&gt;setPrintHeader(false);
  //$pdf-&gt;Header();
  // set document information
  $pdf-&gt;SetCreator(getSiteName());
  $pdf-&gt;SetAuthor('Mobile Solutions');
  $pdf-&gt;SetTitle($personal_data["first_name"] . " " . $personal_data["last_name"]);
  $pdf-&gt;SetSubject("Student's profile");
  $pdf-&gt;setPrintHeader(false);
  
  $pdf-&gt;AddPage();
  
  $pdf-&gt;SetFillColor(52, 21, 0, 76);
  $pdf-&gt;Rect(0, 0, $pdf-&gt;getPageWidth(), $pdf-&gt;getPageHeight(), 'DF', "");
  
  
  $pdf-&gt;SetFont('courier', 'B', 24);
  
  //some html elements
  
  $pdf-&gt;Output($personal_data["first_name"] . "_" . $personal_data["last_name"] . ".pdf", 'D');
  ?&gt;
  </code></pre>
  
  <p>Here I'm being unable to apply the <code>SetFillColor()</code> function to next generated pages. What's the reason for that? TCPDF documentation says it should be apply to all the pages.</p>