Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCPDF - Pagenumbers not exactly right aligned

Tags:

php

tcpdf

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

like image 324
hubbl Avatar asked Mar 30 '11 10:03

hubbl


1 Answers

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! :)

like image 111
njmu83 Avatar answered Oct 21 '22 08:10

njmu83