How to add TCPDF columns

I am using TCPDF and got the following function, which adds the page number to the footer. However, this only centers the pagination, I want to be able to add a description on the left and a reference number on the right. Thus, in other words, 3 columns, the left column on the left are aligned with the description, the middle column with the page number and the centered and right column with the link number and right-aligned.

class MYPDF extends TCPDF {

    // Page footer
    public function Footer() {
        // Position at 15 mm from bottom
        $this->SetY(-15);
        // Set font
    $this->SetFont('Calibri', '', 8);
        // Page number

    $pageNumbers = 'Page '.$this->getAliasNumPage().' of '.$this->getAliasNbPages();

        $this->Cell(0, 10, $pageNumbers, 0, false, 'C', 0, '', 0, false, 'T', 'M');
    }

}
+3
source share
1 answer

The simplest thing is to create three separate cells, one for each element, as follows:

    $this->Cell(30, 10, 'Description', 1, false, 'C', 0, '', 0, false, 'T', 'M');
    $this->Cell(130, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 1, false, 'C', 0, '', 0, false, 'T', 'C');
    $this->Cell(30, 10, 'Reference number', 1, false, 'C', 0, '', 0, false, 'T', 'M');

( $border '1', , ). , , .

+5

All Articles