TCPDF - 页码没有完全正确对齐 [英] TCPDF - Pagenumbers not exactly right aligned

查看:21
本文介绍了TCPDF - 页码没有完全正确对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 TCPDF 生成 pdf.

I am using TCPDF to generate a pdf.

我的问题是来自 Footer() 方法的以下行:

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

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

这是用于在文档页脚中插入页码的标准行,但在输出中右侧有一个小空格.您可以在网站的示例 1 中看到它:http://www.tcpdf.org/examples/示例_001.pdf

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?

问候

推荐答案

我是这样解决的:

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

如果你有超过 99 页,你将再次遇到对齐问题!使用其他方法生成学位论文的 pdf!:)

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

这篇关于TCPDF - 页码没有完全正确对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆