TCPDF:错误的页数

问题描述

我正在创建带有自定义页眉和页脚的PDF,但是,我不明白为什么,当我在页脚中添加图片时,总页数被破坏并添加了两次:

$logoFileName = 'images/image.png';
$logoX = 0; // 0mm
$logoY = $this->GetY()-10; // 0mm
$logoWidth = 200; // 15mm
$logo = 'Pagina ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages() . $this->Image($logoFileName,$logoX,$logoY,$logoWidth);

// $this->SetX($this->w - $this->documentRightMargin - $logoWidth);
$this->Cell(0,10,$logo,false,'R','','T','M');

结果:

使用相同的脚本,如果我删除this->image(),则计数正确。

如果我从脚本中删除以下功能,我也会添加该内容:

$this->getAliasNbPages()

因此变为:

$logo = 'Pagina ' . $this->getAliasNumPage() . '/' . $this->Image($logoFileName,$logoWidth);

第一页是正确的男性,但以下是正确的:

first page second page

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...