2017-03-02 112 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/