使用 fpdf 的新页面的分页符

Niy*_*yas 3 php pdf fpdf

我想使用 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');
     }

    }  
Run Code Online (Sandbox Code Playgroud)

Mat*_*eno 5

例如:

我宣布$i = 0;我的PDF的开始和每一行我在的foreach加算我$i喜欢$i++。例如,如果您想要在行后分页,x您可以说:

if($i%30==0 && $i!=0) {
   $this->addPage();
}
Run Code Online (Sandbox Code Playgroud)

以及添加新页面的功能:

private function addPage()
{
   $this->page = $this->pdf->newPage('A4');
Run Code Online (Sandbox Code Playgroud)

我希望这会为您指明正确的方向。