我想用fpdf创建第二页。下面给出了代码。在指定区域的代码中我想开始新的页面。这里pdf类是从fpdf扩展而来的。
class PDF extends FPDF
{
function header{
$this->Ln(20);
$this->SetFont('Times','',10);
$this->Cell(0,10,'Kondotty');
$this->Ln(10);
$this->SetFont('Times','',10);
$this->Cell(80,0,'07/10/2014');
$this->Cell(60,0,'Seal');
$this->Cell(0,0,'Head of Institution');
//END FIRST PAGE
// STARTING SECOND PAGE
$this->Ln(10);
$this->Cell(27);
$this->Cell(0,10,'Her conduct and character were found ...................................... during that period.');
$this->Ln(20);
$this->SetFont('Times','',10);
$this->Cell(0,10,'Kondotty');
$this->Ln(10);
$this->SetFont('Times','',10);
$this->Cell(80,0,'07/10/2014');
}
}
答案 0 :(得分:2)
例如:
我在PDF的开头声明$i = 0;
,对于我在foreach中添加的每一行,我都会像$i
一样$i++
。
例如,如果您想在x
行之后进行分页,则可以说:
if($i%30==0 && $i!=0) {
$this->addPage();
}
添加新页面的功能:
private function addPage()
{
$this->page = $this->pdf->newPage('A4');
我希望这会指出你正确的方向。