2017-03-02 31 views
1
// Page footer 
public function Footer() { 
    // Position at 15 mm from bottom 
    $this->SetY(-15); 
    // Set font 
    $this->SetFont('helvetica', 'I', 8); 
    // Page number 
    $this->Cell(0, 10, 'Seite '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M'); 
} 

現在我的頁腳看起來是這樣的:如何在TCPDF中使用多行頁腳?

enter image description here]

但我需要多行更KOMPLEX頁腳:

enter image description here]

我怎樣才能做到這一點?

我試着用這個堆棧溢出的建議來解決這個問題:

TCPDF Multiple Footers

但我沒有成功。

回答

2

使用MultiCell某些單元格的寬度組合,這樣的嘗試:

public function Footer() { 
    // Make more space in footer for additional text 
    $this->SetY(-25); 

    $this->SetFont('helvetica', 'I', 8); 

    // Page number 
    $this->Cell(0, 10, 'Seite '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M'); 

    // New line in footer 
    $this->Ln(8); 

    // First line of 3x "sometext" 
    $this->MultiCell(55, 10, 'Sometext', 0, 'C', 0, 0, '', '', true, 0, false, true, 10, 'M'); 
    $this->MultiCell(55, 10, 'Sometext', 0, 'C', 0, 0, '', '', true, 0, false, true, 10, 'M'); 
    $this->MultiCell(55, 10, 'Sometext', 0, 'C', 0, 0, '', '', true, 0, false, true, 10, 'M'); 

    // New line for next 3 elements 
    $this->Ln(4); 

    // Second line of 3x "sometext" 
    $this->MultiCell(55, 10, 'Sometext', 0, 'C', 0, 0, '', '', true, 0, false, true, 10, 'M'); 
    $this->MultiCell(55, 10, 'Sometext', 0, 'C', 0, 0, '', '', true, 0, false, true, 10, 'M'); 
    $this->MultiCell(55, 10, 'Sometext', 0, 'C', 0, 0, '', '', true, 0, false, true, 10, 'M'); 

    // and so on... 
} 

,我從github上這種使用最新的TCPDF 11b的活生生的例子,你可以在頁腳在這裏看到的上面的代碼的結果:

https://wolfish.pl/stack/tcpdf/footer.php

你可以看到如何在TCPDF官方示例使用MultiCell功能更多的例子:https://tcpdf.org/examples/example_005/