TCPDF Align Left Center Right on one line

I want to create a footer for a PDF document that contains a left justified date, centered page creation and alignment. They must be on the same line. I tried the following code:

$this->Cell(0, 10, $date->format('d.m.Y'), 0, false, 'L', 0, '', 0, false, 'T', 'M');
$this->Cell(0, 10, 'Creator', 0, false, 'C', 0, '', 0, false, 'T', 'M');
$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'T', 'M');

The creator shifts to the right and overlays the pages:

PDF Document Footer

Does anyone have a solution to this problem?

+5
source share
2 answers

You need to set the width Cell(), because according to the docs http://www.tcpdf.org/doc/code/classTCPDF.html#a33b265e5eb3e4d1d4fedfe29f8166f31 your $date->format('d.m.Y') Cell()spreading to the right edge, forcing other cells on the line to be located on the right edge.

$w (float) . 0, .

- (, )

$this->Cell(20, 10, $date->format('d.m.Y'), 0, false, 'L', 0, '', 0, false, 'T', 'M');   
$this->Cell(20, 10, 'Creator', 0, false, 'C', 0, '', 0, false, 'T', 'M'); 
$this->Cell(20, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'T', 'M');
+3

TCPDF. , x- 0, "R" . , "R". , .

$this->Cell(0, 9, 'Text-to-be-aligned-right', 0, false, 'R', 0, '', 0, false, 'T', 'M' );
+4

All Articles