0

TCPDFbyを使用してクライアント アプリケーション用の pdf を生成していますcustomising footerfooter私のクライアントは、ページ番号とともに動的なデータを表示したいと考えています。私が直面している問題は、データが 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 に答える