【发布时间】:2014-07-07 13:29:43
【问题描述】:
我正在使用 tcpdf 创建 pdf,我想在页脚中添加版权文本,但此页脚文本显示在页眉上方。这是代码
$this->MultiCell(0, 10, $wpptopdfopts['pdf_footer'], 0, false, 'C', 0, '', 0, false, 'T', 'M');
【问题讨论】:
我正在使用 tcpdf 创建 pdf,我想在页脚中添加版权文本,但此页脚文本显示在页眉上方。这是代码
$this->MultiCell(0, 10, $wpptopdfopts['pdf_footer'], 0, false, 'C', 0, '', 0, false, 'T', 'M');
【问题讨论】:
1.创建扩展TCPDF类的类:
class YourPdfGenerator extends TCPDF {}
2.用您的数据覆盖页脚方法:
public function Footer() {
[...]
$pagenumtxt = $this->l['w_page'] . ' ' . $this->getAliasNumPage() . ' / ' . $this->getAliasNbPages();
$this->SetDrawColor(128, 128, 128);
$this->Line(10, 264, 200, 264);
$this->SetFont('myfont', '', 6);
$this->SetTextColor(80, 80, 80);
$this->SetXY(10, -32);
$this->MultiCell(190, 10, $this->locale($this->lang->trans('report_label_offer_policy')), 0, 'L');
$this->SetFont('myfont', '', 8);
$this->SetXY(10, -14);
$this->Cell(192, 10, $this->locale($date_now), 0, 0, 'L');
$this->SetXY(10, -14);
$this->Cell(190, 10, $pagenumtxt, 0, 0, 'R');
}
3.享受
【讨论】: