【问题标题】:how to add the footer in the tcpdf library如何在 tcpdf 库中添加页脚
【发布时间】:2014-07-07 13:29:43
【问题描述】:

我正在使用 tcpdf 创建 pdf,我想在页脚中添加版权文本,但此页脚文本显示在页眉上方。这是代码

$this->MultiCell(0, 10, $wpptopdfopts['pdf_footer'], 0, false, 'C', 0, '', 0, false, 'T', 'M');

【问题讨论】:

    标签: pdf tcpdf


    【解决方案1】:

    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.享受

    【讨论】:

      猜你喜欢
      • 2014-03-04
      • 1970-01-01
      • 1970-01-01
      • 2017-01-11
      • 2011-08-16
      • 2018-08-06
      • 1970-01-01
      • 1970-01-01
      • 2016-09-11
      相关资源
      最近更新 更多