我试图使用TCPDF来创建一个PDF,并需要在最后一页TCPDF更改页脚
在不同的页脚使用下面的代码我可以在第一页不同的页脚上,但不是最后
我已经看了几个帖子关于这个,但不能使它工作
任何帮助实现这将是非常赞赏
public function Footer() {
$tpages = $this->getAliasNbPages();
$pages = $this->getPage();
$footer = 'NORMAL' . $pages . $tpages;
if ($pages == 1) $footer = 'FIRST' . $pages . $tpages;
if ($pages == $tpages) $footer = 'LAST' . $pages . $tpages;
$this->Cell(0, 10, $footer, 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
这给我
1页 - FIRST13 页2 - NORMAL23 第3页(最后一页)NORMAL23
答:
public function Footer() {
$tpages = $this->getAliasNbPages();
$pages = $this->getPage();
$footer = 'NORMAL' . $pages . $tpages;
if ($pages == 1) $footer = 'FIRST' . $pages . $tpages;
if ($this->end == true) $footer = 'LAST' . $pages . $tpages;
$this->Cell(0, 10, $footer, 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
function display() {
#function that has main text
$this->AddPage();
$html = '1st page';
$this->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
$this->AddPage();
$html = '2nd page';
$this->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
$this->AddPage();
$html = 'Last page';
$this->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
$this->end = true;
}
你找到一个解?我也遇到了调用总页数_before_output()的问题。现在我在我的pdf课程中使用内部计数器。 – Kim 2012-08-17 14:19:24
我刚刚制定了如何使它工作 - 我添加了一个变量,以生成正文的例程结束 - 页脚检查,如果这个变量设置,如果它打印结束页脚 – mjsolo 2012-08-20 08:18:10
你可以更新你的问题到添加修复它的代码? – Kim 2012-08-21 11:28:26