fpdf和新行

时间:2010-07-19 21:23:59

标签: fpdf

为什么文字不会跳转到新行?

http://img826.imageshack.us/img826/2097/pdf.png

我的代码:

<?php
require('fpdf.php');

$pdf=new FPDF('P','mm','A4');
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World! Hello World! Hello World! Hello World! Hello World!Hello World!Hello World!','LRTB');
$pdf->Cell(40,10,'Hello World! Hello World! Hello World! Hello World! Hello World!Hello World!Hello World!','LRTB');
$pdf->Cell(40,10,'Hello World! Hello World! Hello World! Hello World! Hello World!Hello World!Hello World!','LRTB');
$pdf->Ln();
$pdf->Cell(40,10,'Hello World! Hello World! Hello World! Hello World! Hello World!Hello World!Hello World!','LRTB');
$pdf->Cell(40,10,'Hello World! Hello World! Hello World! Hello World! Hello World!Hello World!Hello World!','LRTB');
$pdf->Cell(40,10,'Hello World! Hello World! Hello World! Hello World! Hello World!Hello World!Hello World!','LRTB');
$pdf->Output();
?>

2 个答案:

答案 0 :(得分:2)

“Hello World”字符串在单元格边框上打印。

如果您希望文本在单元格内进行自动换行,请尝试使用MultiCell()方法。

答案 1 :(得分:0)

在最后再尝试一个参数(ln = 2)

$pdf->Cell(40,10,'Hello World! Hello World! Hello World! Hello World! Hello World!Hello World!Hello World!','LRTB', 2);