TCPDF - Pagenumbers not exactly right aligned

hubbl picture hubbl · Mar 30, 2011 · Viewed 12.2k times · Source

I am using TCPDF to generate a pdf.

My issue is the following line from the Footer() method:

$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 'T', false, 'R');

This is the standard line for inserting the pagenumber in the document's footer but there is a litte space to right in the output. You can see it in example 1 from the website: http://www.tcpdf.org/examples/example_001.pdf

If I insert normal text like this:

$this->Cell(0, 10, 'Foobar', 'T', false, 'R');

the text is perfectly aligned to the right without any problems.

I digged into the source, it seems to be something with the encoding, but I don't really get the point.. can somebody help?

regards

Answer

njmu83 picture njmu83 · Oct 20, 2011

i solved it like this:

$this->Cell(0, 0, $this->getAliasRightShift().$this->PageNo().'/'.$this->getAliasNbPages(), 1, 0, 'R');

if you have more than 99 pages, you will again have alignment problems! use something else to generate a pdf of your degree thesis! :)