0

我正在使用TCPDFby为我的客户端应用程序生成 pdf customising footer。我的客户想要显示footer动态数据以及页码。我面临的问题是当数据变得比 pdf 宽度长时,数据不会移动到下一行并且一些文本被裁剪。

Can somebody suggest me solution by which I can shift some text to new line? similar to the one be do in HTML by adding <br>.

或者

Is there a way by which the text moves to next line automatically when the length of the text in footer exceeds the pdf width?

4

1 回答 1

1

按照示例 3 扩展类或使用以下代码

class MYPDF extends TCPDF {
    // Page footer
    public function Footer() {
        // Position at 15 mm from bottom
        $this->SetY(-15);
        // Set font
        $this->SetFont('helvetica', 'I', 8);
        $foot = 'Line 1 \n Line 2 \n 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages()';

        $this->MultiCell(0, 10, $foot, 0, 'C');
    }
}

// create new PDF document
  $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
于 2013-08-16T09:42:35.870 回答