2017-08-17 224 views
-1

我想用TCPDF爲每個頁面設置不同的頁腳。我目前使用自定義頁眉和頁腳,但我還沒有想出如何爲每個頁面設置不同的頁腳。這可能嗎?如何使用TCPDF爲每個頁面設置不同的頁眉/頁腳?

public function Footer() { 

    $this->SetTextColor(168,163,163); 

    // Position at 15 mm from bottom 
    $this->SetY(-17); 
    // Set font 
    $this->SetFont('roboto', 'N', 10); 

    $this->Cell(0, 10, 'Something', 0, false, 'L', 0, '', 0, false, 'T', 'M'); 

    $image_file = K_PATH_IMAGES."logo_example.jpg"; 
    $this->Image($image_file, 96, 272, 15, '', 'JPG', '', 'C', false, 300, '', false, false, 0, false, false, false); 

    // Page number 
    $this->Cell(12, 10, 'página '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'T', 'M'); 
} 

回答

0

只需創建基於頁面數的條件。例如:

if ($this->getAliasNumPage() == "1") 
    $this->Cell(0, 10, 'Something only on the first page', 0, false, 'L', 0, '', 0, false, 'T', 'M'); 
+0

嘿Jakuje謝謝您的回答,我只是嘗試,但沒有工作... – Sher

相關問題